Results 1 to 10 of 10

Thread: form won't submit

  1. #1
    Join Date
    Apr 2008
    Posts
    47
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default form won't submit

    please can someone help me with this form that wont submit.

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


    the code for the php script is
    Code:
    <?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

  2. #2
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,164
    Thanks
    265
    Thanked 690 Times in 678 Posts

    Default

    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?
    Daniel - Freelance Web Design | <?php?> | <html>| español | Deutsch | italiano | português | català | un peu de français | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum

  3. #3
    Join Date
    Apr 2008
    Posts
    47
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    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

  4. #4
    Join Date
    Dec 2009
    Posts
    6
    Thanks
    0
    Thanked 1 Time in 1 Post

    Default

    I think you get just blank page, because your all php script written in one line, and this line started with // (commented line)

  5. #5
    Join Date
    May 2007
    Location
    Boston,ma
    Posts
    2,127
    Thanks
    173
    Thanked 207 Times in 205 Posts

    Default

    Post all you submit.php code if it is formatted as above sepearated onto multiple lines.

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

  6. #6
    Join Date
    Apr 2008
    Posts
    47
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    How's that

    Code:
    <?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');}	?>

  7. #7
    Join Date
    May 2007
    Location
    Boston,ma
    Posts
    2,127
    Thanks
    173
    Thanked 207 Times in 205 Posts

    Default

    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 Code:
    <?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.

    PHP Code:
    $sender_name $_POST['sender_name']; 
    all others in the same format
    PHP Code:
    $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.
    Last edited by bluewalrus; 01-06-2010 at 11:57 PM.

  8. #8
    Join Date
    Apr 2008
    Posts
    47
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    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.

  9. #9
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,164
    Thanks
    265
    Thanked 690 Times in 678 Posts

    Default

    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'];
    Daniel - Freelance Web Design | <?php?> | <html>| español | Deutsch | italiano | português | català | un peu de français | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum

  10. #10
    Join Date
    Apr 2008
    Posts
    47
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    problem resolved. all working fine. thanks for your help

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •