|
Posted by Lars Eighner on 11/15/07 14:00
In our last episode,
<5a860b31-c624-4f3f-a74d-59a507c3075e@f3g2000hsg.googlegroups.com>, the
lovely and talented paul814@excite.com broadcast on comp.lang.php:
> Is it possible in PHP to do the following?
> I've got a php page with a form, that form has radio buttons group and
> an option group list. It also have a button, Continue.
> When the continue button is presed I want it to look at: this:
> If Radiobutton1 is pressed and option group lsteditorial is selected,
> goto write-editorial.php
> if Radiobutton1 is pressed and option group lstpres is selected, goto
> write-press.php
> and etc... for other combinations, so based on the selections of the
> radio buttons and option groups goto a specific page:
HTML cannot do this. Once you have served your page, it is HTML and php has
nothing more to do with it. You can use client-side scripting to
accomplish something like what you want. You cannot have one set of radio
buttons with different actions because to get different actions, they would
have to belong to different forms. What you can do is have the one action
(select.php) generate different pages according to the radio button and
other controls.
Or to put it another way: HTML is markup. It is not a programming
language. It has no conditionals. If you want conditions you have
implement them with client-side scripting or server-side scripting;
but you cannot do it with HTML. An HTML form can only "goto" one place:
the url given for the action attribute. Client-side scripting can alter
that goto according to conditions, or server-side you can generate different
documents to return based on the POST or GET data, but in that case you get
the different returns when "goto" the one handler given in the action
attribute.
This would be abundantly clear if you learned HTML before trying to get php
to generate HTML for you.
--
Lars Eighner <http://larseighner.com/> <http://myspace.com/larseighner>
Countdown: 432 days to go.
What do you do when you're debranded?
Navigation:
[Reply to this message]
|