JillianAL Posted October 22, 2009 Share Posted October 22, 2009 I am looking for some help with a submission form I created using php. I didn't actually create it, I copied the code from another form that works and changed a few of the details. The new form however doesn't work even though, to my untrained eye, the code looks identical to the form that works. The page is connecting to the php because when i submit the form i'm sent to the error page. I just don't know why I'm sent to the error page rather than the form submitting properly and sending an email to the address entered. I'm just faking my way through this because the person who created the first form is gone. So, I would appreciate any help. The code is below. <p class="Header">Recipe Roundup</p> <?php // get posted data into local variables $EmailFrom = "[email protected]"; $EmailTo = "[email protected]"; $Subject = "Recipe Roundup"; $Name = Trim(stripslashes($_POST['Name'])); $Address = Trim(stripslashes($_POST['Address'])); $Recipe = Trim(stripslashes($_POST['Recipe'])); // validation $validationOK=true; if (Trim($Recipe)=="") $validationOK=false; if (Trim($Name)=="") $validationOK=false; if (Trim($Address)=="") $validationOK=false; if (!$validationOK) { print "<meta http-equiv=\"refresh\" content=\"0;URL=recipeerror.htm\">"; exit; } // prepare email body text $Body = ""; $Body .= "Cook's Name: "; $Body .= $Name; $Body .= "\n"; $Body .= "Cook's Email: "; $Body .= $Address; $Body .= "\n"; $Body .= "Recipe: "; $Body .= $Recipe; $Body .= "\n"; // send email $success = mail($EmailTo, $Subject, $Body, "From: <$EmailFrom>"); // redirect to success page if ($success){ print "<meta http-equiv=\"refresh\" content=\"0;URL=recipethankyou.htm\">"; } else{ print "<meta http-equiv=\"refresh\" content=\"0;URL=recipeerror.htm\">"; } ?> <p> </p> Link to comment https://forums.phpfreaks.com/topic/178671-php-code-mystery-form-not-completeemail-not-sending/ Share on other sites More sharing options...
MatthewJ Posted October 22, 2009 Share Posted October 22, 2009 You should post the form Link to comment https://forums.phpfreaks.com/topic/178671-php-code-mystery-form-not-completeemail-not-sending/#findComment-942478 Share on other sites More sharing options...
JillianAL Posted October 22, 2009 Author Share Posted October 22, 2009 Thanks, I should have posted the form. Here it is: <p class="Header">Recipe Roundup </p> <p class="Headline">Get Cooking with your Library!</p> <p>Send us your favorite seasonal and holiday recipes for the library's recipe roundup. It's easy to submit a recipe--just type in the submission form below, or bring a typed or neatly handwritten copy (with photos if possible) to the information desk at any library location. Submissions will be compiled on a blog and in a printed booklet. </p> <p align="center"><a href="http://ccplrecipes.wordpress.com/" target="_blank" class="Headline">Recipe Blog</a> </p><p class="titlebar2">Send us Your Recipe! </p> <p>Use this form to submit your favorite recipe.</p> <form method= "post" action="../recipes/recipetest.php"> <blockquote> <p><strong>Cook's Name:</strong> <input type="text" name="Name" /> <strong>Email:</strong> <input type="text" name="Address" /></p> <p><strong>Enter your recipe below.</strong><br /> <textarea rows="30" cols="60" name="Recipe"></textarea> </p> <p>When you're finished, press the SUBMIT button <em>only once</em>. <input type="submit" name="submit" value="Submit" /> </p> </blockquote> </form> <p> </p> <p align="right"><a href="#"><< Return to the Top</a> </p> <p> </p> <p> </p> Link to comment https://forums.phpfreaks.com/topic/178671-php-code-mystery-form-not-completeemail-not-sending/#findComment-942489 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.