newbiePHP Posted October 10, 2007 Share Posted October 10, 2007 Hi Guys, God willing you'll be able to help me with this. I written this code in PHP designer but when I debug it, it gives me the following error. I included the code and error message. <?php $loctype=$HTTP_POST_VARS["loctype"]; $maptype=$HTTP_POST_VARS["maptype"]; $route=$HTTP_POST_VARS["route"]; $stops=$HTTP_POST_VARS["stops"]; $stop=$HTTP_POST_VARS["stop"]; $vehicledata=$HTTP_POST_VARS["vehicledata"]; I keep getting this error for each line: PHP Notice: Undefined variable: HTTP_POST_VARS in c:\docs.... Any help you can give me to sort this out would be great. Thanks Quote Link to comment https://forums.phpfreaks.com/topic/72598-solved-question-about-http_post_vars/ Share on other sites More sharing options...
newbiePHP Posted October 10, 2007 Author Share Posted October 10, 2007 I should have added that I tried changing HTTP_POST_VARS to just _POST but it just gave me a different error: PHP notice: Undefined index: ... Thanks again Quote Link to comment https://forums.phpfreaks.com/topic/72598-solved-question-about-http_post_vars/#findComment-366077 Share on other sites More sharing options...
trq Posted October 10, 2007 Share Posted October 10, 2007 $HTTP_POST_VARS has long been depricated in favour of $_POST. The indexes your error would be refering to are the ones contained within the array. They will not actually exist untill your form has been submitted. Therefor, you need to wrap all that code in a condition theat checks to see if the form has been submitted. <?php if (isset($_POST['submit'])) { $loctype = $_POST["loctype"]; $maptype = $_POST["maptype"]; $route = $_POST["route"]; $stops = $_POST["stops"]; $stop = $_POST["stop"]; $vehicledata = $_POST["vehicledata"]; } ?> Quote Link to comment https://forums.phpfreaks.com/topic/72598-solved-question-about-http_post_vars/#findComment-366092 Share on other sites More sharing options...
newbiePHP Posted October 10, 2007 Author Share Posted October 10, 2007 That did it. Thanks a lot Thorpe Quote Link to comment https://forums.phpfreaks.com/topic/72598-solved-question-about-http_post_vars/#findComment-366094 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.