Forum Moderators: coopster

Message Too Old, No Replies

PHP submitting form variables

submitting form variables

         

secretceleb

5:35 pm on Aug 10, 2004 (gmt 0)

10+ Year Member



i have collected information from a form which submits to different locations for further functions to be carried out.

the problem i have is that i need the php script to submit the global variables after the function (below) without using <form> tags.

can someone help..

<?
$db = mysql_connect("localhost", "user","password");
mysql_select_db("airport",$db);

$cityname = $_POST["sp-q"];

if ($cityname) {

$result = mysql_query("SELECT * FROM tour WHERE IATA LIKE '%$cityname%'",$db);

$myrow = mysql_fetch_array($result);


$Choice = $myrow["Choice"];
$CountryChoice = $myrow["CountryChoice"];

header("location:http://www.example.com/helpme/destination.php");
exit;

} else { printf("Soz"); }

?>

[edited by: jatar_k at 6:15 pm (utc) on Aug. 10, 2004]
[edit reason] examplified [/edit]

jatar_k

6:17 pm on Aug 10, 2004 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



Have you looked at curl [ca2.php.net]?

secretceleb

3:14 pm on Aug 11, 2004 (gmt 0)

10+ Year Member



you'll have to excuse my lack of knowledge in this department, but what script could i use exactly?

jatar_k

4:33 pm on Aug 11, 2004 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



Well, the simpler way would be to just append them to the url

$Choice = $myrow["Choice"];
$CountryChoice = $myrow["CountryChoice"];

header("location:http://www.example.com/helpme/destination.php?country=$CountryChoice&choice=$Choice");

secretceleb

5:32 pm on Aug 11, 2004 (gmt 0)

10+ Year Member



The only drawback being its a POST form.

my thoughts are there must be a technology to submit existing global variables using a POST command without having to expand some <form>, insert the data, POST the data then close the page.