Posted by Jerry Stuckle on 07/31/07 16:55
ELINTPimp wrote:
> On Jul 31, 12:30 pm, SMP <priggesco...@johndeere.com> wrote:
>> I've got a simple form with an HTML OPTION block. I'd like to POST the
>> form to a page whose name is based on the OPTION they select.
>>
>> So for example say the user selected this option, I'd like to POST the
>> form to a page named "memory.php".
>>
>> echo "<option value=\"memory\">Memory Utilization</option>";
>>
>> Any PHP strategies you could provide would be appreciated. Thanks.
>
> my answering doesn't imply that I agree with this method.
>
> You could use a redirect method:
>
> $option = $_POST['option'];
> $option = //do validation
> header("Location:$option.php");
>
The problem with this is you can't post the form on a header redirect.
There are a couple of ways around it.
The easy way would be to save the values in the $_SESSION array and pick
them out on the next page. Harder would be to use CURL to post the data.
Or you could use javascript on the client side to change the action on
the form. But that requires javascript to be enabled.
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================
[Back to original message]
|