Log in

View Full Version : form won't submit



biomike
01-06-2010, 03:20 PM
please can someone help me with this form that wont submit.

http://www.bioenergyhealing.org.uk/referralThanks


the code for the php script is


<?phperror_reporting (E_ERROR );//---------------------------- Setting the Body of Email (message) --------------------$message = "Name: " . $sender_name . "\n" . "Address: " . $sender_address . "\n" . "Town: " . $sender_town . "\n" . $sender_county . "\n" . "Postcode: " . $sender_postcode . "\n" . "Country: " . $sender_country . "\n" . "\n" . "Sender Email: " . $sender_mail . "\n" . "Phone: " . $tel . "\n" . "Information Requested: " . "\n" . $biohealing . "\n" . $info121 . "\n" . $sender_training . "\n" . "User wants to book: " . "\n" . $sender_book121 . "\n" . $sender_bookworkshop . "\n" . "Please register my details for: " . "\n" . $sender_mailinglist . "\n" . $sender_draw . "\n" . "The user left this message: " . "\n" . $sender_message . "\n" . "The comment submitted was: " . "\n" . $sender_comments . "\n" . "How they found this site: " . "\n" . $source . "\n" . "The magazine referal if selected was: " . $referral . "\n" . "\n";//-------------------------------------- Set and Check Vars ---------------------------$ipaddy = getenv(HTTP_X_FORWARDED_FOR);if($ipaddy == 0){ $ipaddy = $REMOTE_ADDR;}$date = gmDate("D d F y");$from = "Message sent by " . $email . " from " . $ipaddy;$mail_to = "web@raphayad.com";$mail_subject = "BioEnergyhealing Form";$mail_body = $message . "\n" ."-----------------------------\n" . $from . "\n" . $date;$ipdate = "ips.txt";$whatever = 1;$con_to = $sender_mail;$con_subject = "Thank you for your request";$con_body = "This is an automated response. Your information sent from the IP: $ipaddy, was accepted and is being processed (copied below). \n" . "\n" . "Thank you for your interest.\n" . "Should your enquiry require a response we hope to come back to you within 2 working days." . "\n \nAdministration Team " . "\nBioenergy Healing Clinic\n" . "\n" . "http://www.bioenergyhealing.org.uk\n" . "\n" . "NB: This is an automated email." . "\n" . "\n" . "Name: " . $sender_name . "\n" . "Address: " . $sender_address . "\n" . "Town: " . $sender_town . "\n" . "Country: " . $sender_country . "\n" . "Postcode: " . $sender_postcode . "\n" . "Sender Email: " . $sender_mail . "\n" . "Phone: " . $tel . "\n" . "Information Requested: " . "\n" . $biohealing . "\n" . $info121 . "\n" . $sender_training . "\n" . "User wants to book: " . "\n" . $sender_book121 . "\n" . $sender_bookworkshop . "\n" . "Please register my details for: " . "\n" . $sender_mailinglist . "\n" . $sender_draw . "\n" . "The user left this message: " . "\n" . $sender_message . "\n" . "The comment submitted was: " . "\n" . $sender_comments . "\n" . "How they found this site: " . "\n" . $source . "\n" . "The magazine referal if selected was: " . $referral . "\n" . "\n";//------------------------------ Redo Function --------------------------------------function redo($error){ readfile("enq_error.html"); die();}//------------------------------------ Send Mail Code -----------------------------if(mail($mail_to, $mail_subject, $mail_body, "From: webdata@bioenergyhealing.org.uk\r\nReply-to: webdata@bioenergyhealing.org.uk")){ readfile("submitted.htm"); mail($con_to, $con_subject, $con_body, "From: webdata@bioenergyhealing.org.uk\r\nReply-to: webdata@bioenergyhealing.org.uk");}//---------------------------- Reproduce the Previous HTML page --------------------else{ redo('Please try again');} ?>

Michael

djr33
01-06-2010, 03:54 PM
1. The link you posted does not have a form in it.
2. That code is all on one line. Step 1 for debugging: separate the lines, add correct tabs and then it'll be a lot easier to figure out what is wrong.
3. What is actually happening? Technically, I doubt the form is actually "not submitting" (in the sense that "submitting" a form is just sending data from the form to the PHP script). I am guessing you mean the PHP is not sending an email AFTER the form is submitted. Is this correct? Do you get an error message or is there just no response at all?

biomike
01-06-2010, 06:40 PM
oops wrong link . it should be
http://www.bioenergyhealing.org.uk/referral_new.htm

when submitting it goes onto a blank page and i do not get the email.

i didn't right the code so not sure how to seperate it correctly

simplecode
01-06-2010, 06:52 PM
I think you get just blank page, because your all php script written in one line, and this line started with // (commented line)

bluewalrus
01-06-2010, 07:13 PM
Post all you submit.php code if it is formatted as above sepearated onto multiple lines.

I.E


<?phperror_reporting (E_ERROR ); should be line 1
//---------------------------- Setting the Body of Email (message) -------------------- should be line 2 etc.

biomike
01-06-2010, 07:39 PM
How's that



<?phperror_reporting (E_ERROR );
//---------------------------- Setting the Body of Email (message) --------------------
$message =
"Name: " . $sender_name . "\n" .
"Address: " . $sender_address . "\n" .
"Town: " . $sender_town . "\n" .
$sender_county . "\n" .
"Postcode: " . $sender_postcode . "\n" .
"Country: " . $sender_country . "\n" .
"\n" .
"Sender Email: " . $sender_mail . "\n" .
"Phone: " . $tel . "\n" .
"Information Requested: " . "\n" .
$biohealing . "\n" . $info121 . "\n" . $sender_training . "\n" .
"User wants to book: " . "\n" . $sender_book121 . "\n" . $sender_bookworkshop . "\n" .
"Please register my details for: " . "\n" . $sender_mailinglist . "\n" . $sender_draw . "\n" .
"The user left this message: " . "\n" . $sender_message . "\n" . "The comment submitted was: " . "\n" . $sender_comments . "\n" .
"How they found this site: " . "\n" . $source . "\n" . "The magazine referal if selected was: " . $referral . "\n" . "\n";
//-------------------------------------- Set and Check Vars ---------------------------$ipaddy = getenv(HTTP_X_FORWARDED_FOR);
if($ipaddy == 0){ $ipaddy = $REMOTE_ADDR;}$date = gmDate("D d F y");
$from = "Message sent by " . $email . " from " . $ipaddy;$mail_to = "web@raphayad.com";
$mail_subject = "BioEnergyhealing Form";
$mail_body = $message . "\n" ."-----------------------------\n" . $from . "\n" . $date;$ipdate = "ips.txt";$whatever = 1;$con_to = $sender_mail;$con_subject = "Thank you for your request";$con_body = "This is an automated response. Your information sent from the IP: $ipaddy, was accepted and is being processed (copied below). \n" . "\n" .
"Thank you for your interest.\n" .
"Should your enquiry require a response we hope to come back to you within 2 working days." . "\n \nAdministration Team " . "\nBioenergy Healing Clinic\n" . "\n" . "http://www.bioenergyhealing.org.uk\n" . "\n" . "NB: This is an automated email." . "\n" . "\n" . "Name: " . $sender_name . "\n" . "Address: " . $sender_address . "\n" .
"Town: " . $sender_town . "\n" .
"Country: " . $sender_country . "\n" .
"Postcode: " . $sender_postcode . "\n" .
"Sender Email: " . $sender_mail . "\n" .
"Phone: " . $tel . "\n" .
"Information Requested: " . "\n" .
$biohealing . "\n" .
$info121 . "\n" .
$sender_training . "\n" .
"User wants to book: " . "\n" .
$sender_book121 . "\n" .
$sender_bookworkshop . "\n" .
"Please register my details for: " . "\n" . $sender_mailinglist . "\n" . $sender_draw . "\n" .
"The user left this message: " . "\n" . $sender_message . "\n" .
"The comment submitted was: " . "\n" . $sender_comments . "\n" .
"How they found this site: " . "\n" . $source . "\n" .
"The magazine referal if selected was: " . $referral . "\n" . "\n";
//------------------------------ Redo Function --------------------------------------function redo($error){ readfile("enq_error.html");
die();}
//------------------------------------ Send Mail Code -----------------------------
if(mail($mail_to, $mail_subject, $mail_body, "From: webdata@bioenergyhealing.org.uk\r\nReply-to: webdata@bioenergyhealing.org.uk")){ readfile("submitted.htm");
mail($con_to, $con_subject, $con_body, "From: webdata@bioenergyhealing.org.uk\r\n
Reply-to: webdata@bioenergyhealing.org.uk");
}//---------------------------- Reproduce the Previous HTML page --------------------else{ redo('Please try again');} ?>

bluewalrus
01-06-2010, 08:02 PM
Try this but I don't see where you've set these variables, or did you get this code somewhere and haven't initialized it your self? For example $sender_name where is the name being set? If this is your whole code I think that'd be the problem, the one line code before could've been it...


<?php
error_reporting (E_ERROR );
//---------------------------- Setting the Body of Email (message) --------------------
$message = "Name: " . $sender_name . "\n" . "Address: " . $sender_address . "\n" . "Town: " . $sender_town . "\n" . $sender_county . "\n" . "Postcode: " . $sender_postcode . "\n" . "Country: " . $sender_country . "\n" . "\n" . "Sender Email: " . $sender_mail . "\n" . "Phone: " . $tel . "\n" . "Information Requested: " . "\n" . $biohealing . "\n" . $info121 . "\n" . $sender_training . "\n" . "User wants to book: " . "\n" . $sender_book121 . "\n" . $sender_bookworkshop . "\n" . "Please register my details for: " . "\n" . $sender_mailinglist . "\n" . $sender_draw . "\n" . "The user left this message: " . "\n" . $sender_message . "\n" . "The comment submitted was: " . "\n" . $sender_comments . "\n" . "How they found this site: " . "\n" . $source . "\n" . "The magazine referal if selected was: " . $referral . "\n" . "\n";
//-------------------------------------- Set and Check Vars ---------------------------
$ipaddy = getenv(HTTP_X_FORWARDED_FOR);
if($ipaddy == 0) {
$ipaddy = $REMOTE_ADDR;}$date = gmDate("D d F y");
$from = "Message sent by " . $email . " from " . $ipaddy;$mail_to = "web@raphayad.com";
$mail_subject = "BioEnergyhealing Form";
$mail_body = $message . "\n" ."-----------------------------\n" . $from . "\n" . $date;$ipdate = "ips.txt";$whatever = 1;$con_to = $sender_mail;$con_subject = "Thank you for your request";$con_body = "This is an automated response. Your information sent from the IP: $ipaddy, was accepted and is being processed (copied below). \n" . "\n" . "Thank you for your interest.\n" . "Should your enquiry require a response we hope to come back to you within 2 working days." . "\n \nAdministration Team " . "\nBioenergy Healing Clinic\n" . "\n" . "http://www.bioenergyhealing.org.uk\n" . "\n" . "NB: This is an automated email." . "\n" . "\n" . "Name: " . $sender_name . "\n" . "Address: " . $sender_address . "\n" . "Town: " . $sender_town . "\n" . "Country: " . $sender_country . "\n" . "Postcode: " . $sender_postcode . "\n" . "Sender Email: " . $sender_mail . "\n" . "Phone: " . $tel . "\n" .
"Information Requested: " . "\n" . $biohealing . "\n" . $info121 . "\n" . $sender_training . "\n" . "User wants to book: " . "\n" . $sender_book121 . "\n" . $sender_bookworkshop . "\n" . "Please register my details for: " . "\n" . $sender_mailinglist . "\n" . $sender_draw . "\n" . "The user left this message: " . "\n" . $sender_message . "\n" . "The comment submitted was: " . "\n" . $sender_comments . "\n" . "How they found this site: " . "\n" . $source . "\n" . "The magazine referal if selected was: " . $referral . "\n" . "\n";
//------------------------------ Redo Function --------------------------------------
function redo($error){ readfile("enq_error.html");
die();
}
//------------------------------------ Send Mail Code -----------------------------
if(mail($mail_to, $mail_subject, $mail_body, "From: webdata@bioenergyhealing.org.uk\r\nReply-to: webdata@bioenergyhealing.org.uk")) {
readfile("submitted.htm");
mail($con_to, $con_subject, $con_body, "From: webdata@bioenergyhealing.org.uk\r\nReply-to: webdata@bioenergyhealing.org.uk");
}
//---------------------------- Reproduce the Previous HTML page --------------------
else { redo('Please try again');
}
?>

To be more specific at line 2 you should add in maybe 30 lines getting your values to variables and your method should have quotes method="post"... On to getting the variables.


$sender_name = $_POST['sender_name'];
all others in the same format


$variable_name = $_POST['input_name_in_form'];

You can put these anywhere, but line 2 would be your best place because you are using them at line 4 and they have to be declared before they can be used.

biomike
01-07-2010, 12:03 PM
SOmeone updated this code for me but inadvertantly i overwrote with an old version.

I have updated the code as suggested. I am now receiving the form by email but the fields do not have the results. The visitor is also not getting their confirmation email.

djr33
01-07-2010, 05:00 PM
Then look at the post above. You need to set the variables sent in the email to values from the submitted form. <input name="....."> is available in $_GET['....'] or $_POST['....'] depending on <form method="GET"> <form method="POST">.
$variablename = $_GET['fieldname'];
or
$variablename = $_POST['fieldname'];

biomike
01-07-2010, 06:01 PM
problem resolved. all working fine. thanks for your help