You are here: Re: POST form to dynamic page name « PHP Programming Language « IT news, forums, messages
Re: POST form to dynamic page name

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
==================

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация