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

?>

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.