Re: Form Processing
| From: | joe at jWebMedia dot com | Date: | Tue, 22 Aug 2000 13:21:20 +0000 |
| Subject: | Re: Form Processing | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-12932@lists.php.net to get a copy of this message | ||
Yeah, that was the general idea of what I was looking for. The only way I've
done it before was in Perl, in which case you split the name:value pairs from
stdin. I want the email to just list all of the fields, so I don't have to.
But I can handle that part of it. Thanks for leading me in the right
direction.
Joe
Dean Hall wrote:
> 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.