close ad
 
Important WebAssist Announcement
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

Two Forms on One Page

Thread began 6/08/2011 7:21 pm by pete | Last modified 6/17/2011 6:56 am by Jason Byrnes | 10119 views | 12 replies |

pete

Two Forms on One Page

I'd like to put two forms on one page. I've created a site where there are two forms on different pages and it's not that difficult. I'm having a heck of a time with two different forms on the one page though.

Intention: a small newsletter signup in the footer on every page (working well) and a larger form in addition to the footer form on a Contact Us sort of page.

I think I'm not keeping straight what WA files can be used for multiple purposes and what needs to be dedicated to one purpose.

If anyone out there can help, I'd be grateful.

Thanks,
Pete

Sign in to reply to this post

Jason ByrnesWebAssist

when you have 2 forms on one page, you need to make sure that the have unique names for the submit button.


you also need to edit the server side code that processes the form to use the submit button as the trigger instead of a generic POST.

Sign in to reply to this post

pete

Originally Said By: Jason Byrnes
  you also need to edit the server side code that processes the form to use the submit button as the trigger instead of a generic POST.  



Hi Jason,
Thanks for the reply. I'm not sure how to go about the second point. Are there any available summaries or examples?

Thx,
Pete

Sign in to reply to this post

Jason ByrnesWebAssist

on the cantact for solution pack contacty us page, the likne of code that trigers validation for the contact form looks like this:
[php]
if ($_SERVER["REQUEST_METHOD"] == "POST") {
[php]


the line of code that trigers the email to be sent looks like this:

php:
if ((($_SERVER["REQUEST_METHOD"] == "POST") && (isset($_SERVER["HTTP_REFERER"]) && strpos(urldecode($_SERVER["HTTP_REFERER"]), urldecode($_SERVER["SERVER_NAME"].$_SERVER["PHP_SELF"])) > 0) && isset($_POST)))     {




the submit button is named Submit:

php:
<input type="submit" value="Submit" class="inputButton"/>




so change those 2 lines of code to:

php:
if ((isset($_POST["Submit"])))     {




so that the form is only processed if the submit button is pressed.

Sign in to reply to this post

pete

Hi Jason,

Thanks for this - I'll give it a try. For the line of code you provide:

if ((isset($_POST["Submit"]))) {

If I have a second form, should the code read

if ((isset($_POST["Submit2"]))) {

for the second submit? (Or whatever I end up calling it...)

Thanks,
Pete

Sign in to reply to this post

Jason ByrnesWebAssist

yes, that is correct.

Sign in to reply to this post

pete

Thankyou!
Pete

Sign in to reply to this post

pete

Still Stuck...

Hi again,
I finally got back to this project and I'm afraid that I'm still stuck. Here's the page scenario for a Contact Us page with two contact forms on it. I've called this page contact.php.

In the main area, a contact form for general use. (I've put the Contact Solution Form files in a directory called 'contact_main/'. In the footer on this page and every other page in the site, I put a newsletter signup, directing the CSF files to another directory called 'contact_footer/'.

The code for the page called contact.php is attached as a zipped text file. The specific error I'm getting (aside from no email) is: Warning: Cannot modify header information - headers already sent by (output started at /home/resc9892/public_html/tcp/contact.php:13) in /home/resc9892/public_html/tcp/contact_main/WA_ValidationToolkit/WAVT_Scripts_PHP.php on line 68

Any assistance would be greatly appreciated, thanks.
Pete
------------------------------------------------------------------------------------------

Sign in to reply to this post

Jason ByrnesWebAssist

see the following post for details on troubleshooting the headers already sent error:
showthread.php?t=19285


please dont past the php code into a text file.

please send the php page instead.

Sign in to reply to this post

pete

I think I've cleared the header error now, thanks. I've also removed the txt file (with apologies...) Now to focus on that two-form question. I've attached the .php file as directed.

Thanks,
Pete

Attached Files
contact.zip
Sign in to reply to this post
loading

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question

Content

rating

Layout

rating

Ease of use

rating

security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...