PDA

View Full Version : Contact Form not working - Help please!!



Jonathan Mark Sharp
09-13-2007, 07:29 AM
Hi,

I am new to BV and have just published my site: www.susancoates.co.uk (http://www.susancoates.co.uk) and have two problems of which I will deal with separately (the second I will raise under a new thread).

The first here - I have completed the contact page (based on the template in the ABVFP v2) and produced the thank you action.php file (having cut the sample code from from tutorial) which I have uploaded. I am getting a "page not found" message when trying to test this.

I think I must have an error in the HTML code in the action.php file (made the changes in the wrong place?) but being a complete HTML novice I just can't see what I am doing wrong.

Can someone take a look please?

Thanks

Jon

navaldesign
09-13-2007, 11:00 AM
Ok, there are at least the following two mistakes:

1: The form "action" is set to be "dbts_abvfp.php". Since you are not using ABVFP (you only made your form similar to the ABVFP template) the form action should be changed to be "action.php" because as you say this is how you saved / published it.

2. The action page itself. is in http://www.susancoates.co.uk/action.php

However, the action page itself has some problem, having to do with the code you pasted. You have either missed something or added something where you shouldn't. The only way we can help youi about this would be you posting here the php code you have embedded in your page.

Jonathan Mark Sharp
09-13-2007, 08:49 PM
Hi,

thanks for getting back to me.

I have completed the change to the contact form and it now shows "action.php" as advised.

However, I am now getting the following error message:

Parse error: syntax error, unexpected '@' in /home/emjqtlmi/public_html/action.php on line 80

The code I have posted in the "Beginning of body" is as follows:
(incidentally it is really confusing going through the video tutorial being told one thing and then being told to do something completely different in the text that follows it.)

Many thanks

Jon

<?PHP
$mailto = "exampleemail@example.com";
$email = $HTTP_POST_VARS['email'];
if ($email == "") {
$email = $mailto;jonandsuzy@btinternet.co.uk}
$mailsubj = "Contact Form Submission";
$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);
?>

navaldesign
09-13-2007, 08:58 PM
You have mistaken this line :

$email = $mailto;jonandsuzy@btinternet.co.uk}

Should be simply:


$email = $mailto;
}

Your real email goes instead in this other line:

$mailto = "exampleemail@example.com";

which should become

$mailto = "jonandsuzy@btinetrnet.co.uk";

Jonathan Mark Sharp
09-13-2007, 09:30 PM
Thanks very much for the advice - it is now working. Only one question left in relation to this now - in the email I receive the order of the fields is as follows (which is not the same order as in the form - I'd like to change this (obviously it seems logical to have the first name at the top) - is this possible and how do I do it?

MANY THANKS

Jon

Values submitted from web site form :
Formid : 2
Last_Name :
email :
Telephone :
Mobile :
Comments :
Priority :
Answer_by :
First_Name :

navaldesign
09-13-2007, 09:41 PM
Open your form page in BV. Right click on the field you want first, and select Move to Front. repeat for the field you want second, and so on. Include in this procedure your submit and reset buttons. Save the form page, publish, and RFRESH your browser before testing

Jonathan Mark Sharp
09-13-2007, 09:43 PM
Brilliant! Thanks so much - you are a real star.