spikypunker Posted October 20, 2009 Share Posted October 20, 2009 I've got a simple form and it's not sending the variables!!!!! <form action="mail.php" method="POST"> Name:<Br /> <input name="name" type="text" width="250"/> <br /><br /> Email:<Br /> <input name="email" type="text" width="250"/> <br /><Br /> Enquiry:<Br /> <textarea name="message" cols="50" rows="8"></textarea> <Br /><br /> <input name="" type="submit" value="Enter"/> </form> <?php $return = $HTTP_POST_VARS['email']; $name = $HTTP_POST_VARS['name']; $message = $HTTP_POST_VARS['message']; $subject = 'Contact From CornerStone website'; $content = $return . ' ' . $name . ' ' . $message; $to = '#'; mail($to, $subject, $content, $headers); echo "$to, $subject, $content, $headers"; ?> And it's making me VERY ANGRY!!!! Link to comment https://forums.phpfreaks.com/topic/178385-php-isnt-passing-the-variables/ Share on other sites More sharing options...
Daniel0 Posted October 20, 2009 Share Posted October 20, 2009 Is that within the scope of some function or something? $HTTP_POST_VARS is not a superglobal like $_POST is. Also $HTTP_POST_VARS has been deprecated since 4.1.0, so throw your book away and buy a new one! Link to comment https://forums.phpfreaks.com/topic/178385-php-isnt-passing-the-variables/#findComment-940722 Share on other sites More sharing options...
spikypunker Posted October 20, 2009 Author Share Posted October 20, 2009 ARRRGGGH it's too late to be doing this!! It's now passing the variables but it's not redirecting to thanks.php at the end! I've done this same thing a hundred times!!! WHY IS IT DOING TTHHIIISSSSSS <?php $return = $_POST'email']; $name = $_POST['name']; $message = $_POST['message']; $subject = 'Contact From CornerStone website'; $content = $return . ' ' . $name . ' ' . $message; $to = '[email protected]'; mail($to, $subject, $content, $headers); echo "<meta http-equiv=\"refresh\" content=\"0;URL=thanks.php\">"; ?> Link to comment https://forums.phpfreaks.com/topic/178385-php-isnt-passing-the-variables/#findComment-940728 Share on other sites More sharing options...
Daniel0 Posted October 20, 2009 Share Posted October 20, 2009 Have you checked that it's actually output? Also, you should use a proper header for redirecting. Link to comment https://forums.phpfreaks.com/topic/178385-php-isnt-passing-the-variables/#findComment-940730 Share on other sites More sharing options...
spikypunker Posted October 20, 2009 Author Share Posted October 20, 2009 Ok it's working now, turns out my internet is just being a £$%^&*( But yeah, thats how i always redirect, is there a better way? Link to comment https://forums.phpfreaks.com/topic/178385-php-isnt-passing-the-variables/#findComment-940731 Share on other sites More sharing options...
Daniel0 Posted October 20, 2009 Share Posted October 20, 2009 Doing like this is better: header('Location: destination.php'); Strictly speaking, the destination is required to be a fully qualified URL in the RFC, but all browsers work with relative URLs as well. Link to comment https://forums.phpfreaks.com/topic/178385-php-isnt-passing-the-variables/#findComment-940732 Share on other sites More sharing options...
Kaboom Posted October 20, 2009 Share Posted October 20, 2009 Ok it's working now, turns out my internet is just being a £$%^&*( But yeah, thats how i always redirect, is there a better way? Um ... header ('Location: thanks.php'); maybe? Link to comment https://forums.phpfreaks.com/topic/178385-php-isnt-passing-the-variables/#findComment-940733 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.