Jump to content

[SOLVED] Question about HTTP_POST_VARS


newbiePHP

Recommended Posts

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

 

Link to comment
https://forums.phpfreaks.com/topic/72598-solved-question-about-http_post_vars/
Share on other sites

$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"];
}

?>

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.