Re: Form Processing
| From: | Dean Hall | Date: | Mon, 21 Aug 2000 22:12:36 +0000 |
| Subject: | Re: Form Processing | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-12822@lists.php.net to get a copy of this message | ||
On Mon, 21 Aug 2000 joe@jWebMedia.com wrote:
> I am trying to get a php script to read the stdin from a form and print
> a line for each value there. I need to check if someone is going to pay
> with a credit card. If so, I need to display them a different page. In
> addition, the script needs to send off an email regardless. I have tried
> to read the stdin like:
> $fp = fopen("php://stdin","r");
> $contents = fread($fp, 500000); <-- This number is just for testing
> now...
>
> if I echo $contents - it says it's an array - so I try echo
> $contents[0]; and get nothing. I've also tried $contents =
> parse_url($QUERY_STRING); and $REQUEST_URI as I saw in the users
> additions to the manual and on the list archives. What am I doing wrong?
> Or am I way off on my approach to this? Thanks,
>
> Joe
Yes, you're way off. (Sorry so blunt.) Well, let me rephrase that. You are
way off if you're talking about an HTML form with a GET or POST method. If
you aren't talking about this, I have no idea what the hell you're talking
about.
In any case, on your form, I guess you know that it should have an
action like this:
<form method="POST" action="form_handler.php">
Then form_handler.php is the file that handles the form submission.
Also, each input tag should have a name.
<input type="text" name="address">
So now in "form_handler.php" or whatever you call it can access the value
of the "address" input field like this:
$HTTP_POST_VARS[address]
(or if you the "register globals" option on, just '$address')
So if the user typed "123 Main St. #6" in the text field whose name is
"address", you could say:
echo $HTTP_POST_VARS[address];
and you'd see "123 Main St. #6".
Simple, huh?
Well, if you are searching for a solution to some highly advanced problem,
my apologies, and I will go put my dunce cap on now. If this is what you
were looking for, wonderful!
Dean.