Re: How to send POST info without a form?

From: Date: Wed, 02 Oct 2002 06:45:03 +0000
Subject: Re: How to send POST info without a form?
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-118542@lists.php.net to get a copy of this message
try www.sloppycode.net * © Sloppycode.net All rights reserved. * @title Html Source class - api for getting/posting to websites * @author C.Small * @version 1.0 or phpclasses.org Elias, "Chris Nielsen" <cnielsen@newdawntech.com> wrote in message news:20021002050851.90480.qmail@pb1.pair.com... > 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. > >

« previous php.general (#118542) next »