RE: [PHP] How to send POST info without a form?
| From: | Martin Towell | Date: | Wed, 02 Oct 2002 05:04:43 +0000 |
| Subject: | RE: [PHP] How to send POST info without a form? | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-118538@lists.php.net to get a copy of this message | ||
from the client end, you can't
from the server end, you can use curl.
HTH
Martin
-----Original Message-----
From: Chris Nielsen [mailto:cnielsen@newdawntech.com]
Sent: Wednesday, October 02, 2002 3:09 PM
To: php-general@lists.php.net
Subject: [PHP] How to send POST info without a form?
I have a single php file that I want to do some different things (only one
at a time, based on a conditional):
display a form to the user for input
submit information from (above) form to database
list information in database (that has been INSERTed by the above)
I want this file to be able to call itself using the following code:
$input = $_SERVER['PHP_SELF']."?action=INPUT";
$list = $_SERVER['PHP_SELF']."?action=LIST";
print '<a href="'.$input.'">Input a new
user</a><br>';
print '<a href="'.$list.'">List all users</a>';
but I want to submit the action value as a POST rather than a GET. I then
have conditionals around each of my modules that check $_POST['action'] for
one of three values and only print that module if that's the action I need
the file to perform.
Basically I'm trying to figure out how to lump this all into one file.
Obviously I could split it into three files that do each of the desired
actions, but I would then also have to have a fourth file which provides a
front end into it, which I don't want to do and is what got me started down
this path.
How can I submit POST information to a php file without using an HTML form?
TIA.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php