Is there a way to use POST using just code and no forms?
Posted: Sun May 18, 2008 3:13 am
I am trying to send data with POST variables using mostly php code. I know that a user could click on a form and have it transmit POST variables to a script; however, I am looking to to do just the opposite and transmit from a script post data.
For example:
The "header ("Location: $URL")" command has given me trouble since I can't echo data before I issue that command or else I get an error; therefore, I can't use some of the usual options such as forms and so forth.
I have had to store the variable's contents to a mysql database in order to pass on the data to the form; however, I would MUCH rather just send the data using POST variables or some other similar method. How would I send those two variable's data to the page "form.php" automatically without waiting for a user to click any buttons or anything? Thanks in advance!
For example:
Code: Select all
<?php
//A string too long for GET
$tooLongForGET = "Ipsum epsum lorem indige...you get the idea..."
//Another string too long for GET
$tooLongForGET2 = "Ipsum epsum lorem indige..."
$URL="http://localhost/test/form.php";
header ("Location: $URL");
?>I have had to store the variable's contents to a mysql database in order to pass on the data to the form; however, I would MUCH rather just send the data using POST variables or some other similar method. How would I send those two variable's data to the page "form.php" automatically without waiting for a user to click any buttons or anything? Thanks in advance!