monkeypaw201 Posted April 22, 2008 Share Posted April 22, 2008 the following code: <?php //Check to make sure the form has been posted and not just viewing the page. if ($_POST['submit']){ //Declare the variables $FullName = Trim(stripslashes($_POST['full_name'])); $Email = Trim(stripslashes($_POST['email'])); $Message = Trim(stripslashes($_POST['message'])); //set the message recipient $to = '[email protected]'; //set the email subject $subject = 'Website Contact'; //create the email message $mes = "Hello; \n\nYou have recieved an email from "; $mes .= "your website's contact form. The message is below for your convenience. \n\n ****************************** \nFull Name: "; $mes .= $FullName; $mes .= "\n"; $mes .= "Email: "; $mes .= $Email; $mes .= "\n"; $mes .= "Message: "; $mes .= $Message; $mes .= "\n ****************************** \n\n This Is An Automatically Generated Message, Do Not Repond!"; $message = $mes; //call the headers $headers = "From: [email protected]\r\n" . 'X-Mailer: PHP/' . phpversion() . "\r\n" . "MIME-Version: 1.0\r\n" . "Content-Type: text/html; charset=utf-8\r\n" . "Content-Transfer-Encoding: 8bit\r\n\r\n"; //send the email if(mail($to, $subject, $message, $headers)){ //redirect successpage echo '<meta http-equiv="refresh" content="5;url=' . $row_Settings['base_url'] . $row_Settings['directory']. $_POST['cpage'] .'&cxt=Your Message Has Been Sent!">'; }else{ // redirect with error message echo '<meta http-equiv="refresh" content="5;url=' . $row_Settings['base_url'] . $row_Settings['directory']. $_POST['cpage'] .'&cxt=There Was An Error Sending The Message, Please Try Again!">'; } }//close if submitted tage ?> <?php if(isset($_GET['cxt'])){ echo $_GET['cxt']; } ?> <form method="POST" action="Pages/Add_Ons/Contact/form.php"> <table width="100%" border="0"> <tr> <td>Full Name:</td> <td><span id="sprytextfield1"> <label> <input type="text" name="full_name" id="full_name"> </label> <span class="textfieldRequiredMsg">You Must Enter Your Full Name!</span></span></td> </tr> <tr> <td>E-Mail Address:</td> <td><span id="sprytextfield2"> <label> <input type="text" name="email" id="email"> </label> <span class="textfieldRequiredMsg">You Must Enter Your E-Mail Address!</span></span></td> </tr> <tr> <td>Message:</td> <td><span id="sprytextarea1"> <label> <textarea name="message" id="message" cols="45" rows="5"></textarea> </label> <span class="textareaRequiredMsg">You Must Enter A Message To Send!</span></span></td> </tr> <tr> <td> </td> <td> </td> </tr> <tr><input name="cpage" type="hidden" value="home.php?page=" /> <td colspan="2"><label> <div align="center"> <input type="submit" name="submit" id="button" value="Send Message"> </div> </label></td> </tr> </table> </form> gives the following error Notice: Undefined index: submit in /var/www/vhosts/manageyourva.com/httpdocs/Dev/Pages/Add_Ons/Contact/form.php on line 3 im not sure whats wrong.. any ideas? Link to comment https://forums.phpfreaks.com/topic/102413-undefined-index-submit/ Share on other sites More sharing options...
Northern Flame Posted April 22, 2008 Share Posted April 22, 2008 try doing this: if (isset($_POST['submit'])){ in line 3 Link to comment https://forums.phpfreaks.com/topic/102413-undefined-index-submit/#findComment-524429 Share on other sites More sharing options...
monkeypaw201 Posted April 22, 2008 Author Share Posted April 22, 2008 that worked, now i have a add-on dilema... that script theoretically needs to post to itself, the problem is it is being included and the $_POST variables don't reach that page for some reason.. so i thought, could it simply generate a pop-up that executes and says something like "Thanks for sending!" or maybe go to the actual script URL and meta redirect immediately? Link to comment https://forums.phpfreaks.com/topic/102413-undefined-index-submit/#findComment-524435 Share on other sites More sharing options...
Northern Flame Posted April 22, 2008 Share Posted April 22, 2008 so you mean you want to send the post variables to form.php if so, you can do that with cURL() Link to comment https://forums.phpfreaks.com/topic/102413-undefined-index-submit/#findComment-524443 Share on other sites More sharing options...
monkeypaw201 Posted April 22, 2008 Author Share Posted April 22, 2008 ok, i dont know what curl() does, and i thought that was just a linux command line command? Link to comment https://forums.phpfreaks.com/topic/102413-undefined-index-submit/#findComment-524444 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.