PDA

View Full Version : Help with forms



hjmotie
08-06-2007, 10:53 AM
Help. Am new to all of this, and struggling. My website is www.villainthesunshine.com (http://www.villainthesunshine.com)
On the booking page I have a form. If I click on the form submit button, although I can see action.php come up in the bottom left hand corner, nothing happens; no thank you page and no email.

The booking form is currently set to action.php, post and multipart/form-data.
The action.php page is set to php in page properties and the html is in Beginning of Body and reads:
<?PHP
$mailto = "booking@villainthesunshine.com";
$email = $HTTP_POST_VARS['email'];
if ($email == "") {
$email = $mailto;booking@villainthesunshine.com
}
$mailsubj = "Villa Booking";
$mailhead = "From: $email\n";
reset ($HTTP_POST_VARS);
$mailbody = "Values submitted from web site form :\n";
while (list ($key, $val) = each ($HTTP_POST_VARS))
{
if ($key!="submit")
{
$mailbody .= "$key : $val\n";
}
}
mail($mailto, $mailsubj, $mailbody, $mailhead);
?>

Any advice gratefully received!

navaldesign
08-06-2007, 02:15 PM
1. All your form fields need to be named. Right now they have the default names "Editbox 1" etc.
2. The action page needs to be edited, there is some code problem. Probably the ?> missing at the end, but maybe not the only problem.
3. Remove the Onclick Show event you have added to the submit button.

Then try again

philipc9635
08-06-2007, 03:18 PM
Hello

I actually added a contact form today on my site and followed the instructions to the letter. The only problem I had was that I saved my Thankyou page as, thankyou

The form wouldn't work until I changed the page name to action

Offcourse I set the extension to php as apposed to html

For your information

hjmotie
08-07-2007, 10:15 PM
Fantastic! I made the field name changes, got rid of the OnClick show event on the submit button, and copied in the hmtl from a different form tutorial, and now I get the thank you page. Progress
Only trouble is, the email is not reaching me. My email address is booking@villainthesunshine.com. When I test this email address it works fine. I assume therefore that this is a problem on the action page? The html script on this page that I pasted in now reads:
<?PHP
$email = $HTTP_POST_VARS[email];
$mailto = "booking@villainthesunshine.com";
$mailsubj = "Villa Booking Request";
$mailhead = "From: $email\n";
reset ($HTTP_POST_VARS);
$mailbody = "Values submitted from web site form:\n";
while (list ($key, $val) = each ($HTTP_POST_VARS))
{
$mailbody .= "$key : $val\n";
}
mail($mailto, $mailsubj, $mailbody, $mailhead);
?>
</BODY>
</HTML>

navaldesign
08-07-2007, 11:11 PM
Probably because your Email field should be "email" with lower case "e".
if you name it "Email" the script dosn't see it. Change this line of the script:
$email = $HTTP_POST_VARS[Email];

hjmotie
08-07-2007, 11:22 PM
Sorry, am rather confused. The first reference to email in this line is lower case, as per the script above. I tried changing the second email E to upper case, as per your example, but this hasnt made any difference.

navaldesign
08-07-2007, 11:29 PM
The script and the form MUST have the email field named the same. Since you have named the email field in your form "Email" the script has to be modified as i indicated above, otherwise you need to rename the email field in the form, to be "email".

The second email field (Confirm Email) does NOT play any role as far as the form submission is concerned.

Refresh your browser before testing the form again

hjmotie
08-07-2007, 11:33 PM
Also, as I am testing out the form, if I incorrectly fill in a box and press submit, it is telling me to change the box as in it's original name eg editbox1 rather than the name that I have given it. Any thoughts please?

navaldesign
08-07-2007, 11:40 PM
In the validation section, check "Custom error message" and fill in the name that you have given

hjmotie
08-08-2007, 09:20 AM
I understand now. Thank you. I have changed the name of the Email field on the form to email. Sadly, still no email arriving...
I have checked the Custom Error Message box, and added in some error messages, and these are working fine.

derynmcg
08-09-2007, 01:48 AM
I am having the same problem. When testing, I click through to my action page ok but I recieve no email. As above, I have followed the tutorial to the letter, and have used action.php, post and multipart etc. Have named my action page action and made sure it is php not html and have added the php script to beginning of body. No email.

My php script is as follows:

<?PHP
$mailto = "alert1st@ihug.co.nz";
$email = $HTTP_POST_VARS['email'];
if ($email == "") {
$email = $mailto;alert@ihug.co.nz
}
$mailsubj = "Chemical free report";
$mailhead = "From: $email\n";
reset ($HTTP_POST_VARS);
$mailbody = "Values submitted from web site form :\n";
while (list ($key, $val) = each ($HTTP_POST_VARS))
{
if ($key!="submit")
{
$mailbody .= "$key : $val\n";
}
}
mail($mailto, $mailsubj, $mailbody, $mailhead);
?>


My website address is www.nutartnz.com (http://www.nutartnz.com)

Any advice is welcome

derynmcg
08-09-2007, 02:13 AM
I wonder too - I have Dreamweaver on my PC which I can't remove as it's being used for other things by other people. But when I go into ftp manager I see that when I connect, my action.php file has the dreamweaver icon attached to it. I think this is interfering and bluvoda doesn't recognize it (which would be natural). No matter how many times I do this it still the action.php still defaults to dreamweaver. What icon should there be (internet explorer?). Any ideas how to fix this?

hjmotie
08-09-2007, 03:51 PM
Folks, see the next forum thread; I've discovered that my emails are being triggered, they are just not reaching me. Gearing up for another three hours trying to figure out why now...
NavalDesign; thanks SO much for your input so far - hugely appreciated!!

navaldesign
08-09-2007, 04:24 PM
I wonder too - I have Dreamweaver on my PC which I can't remove as it's being used for other things by other people. But when I go into ftp manager I see that when I connect, my action.php file has the dreamweaver icon attached to it. I think this is interfering and bluvoda doesn't recognize it (which would be natural). No matter how many times I do this it still the action.php still defaults to dreamweaver. What icon should there be (internet explorer?). Any ideas how to fix this?

If you have associated the .php files to Feamweaver, the icon will be that of dreamweaver.

PHP files are nor recognized by BV. It only recognizes files with .bvp extension which it creates.