NYCPHP Meetup

[nycphp-talk] OT?: HTML question

David Krings ramons at gmx.net
Sat Oct 14 08:57:25 EDT 2006


Yes, but since I have to do a comparison in the target script anyway, what 
difference does it make if I do a string compare with 'home' or 'no place 
like home'.

Uh! Wait! Phase 6 of my project lists internationalization.....can't do it 
the way I have it now unless I want to add cases for every language string 
out there. Point well taken!
So I guess with a simple isset() on the array element I get what I need 
without worrying what the value is. This is so clever!

Really nice example that shows what people mean when they talk about 
seperating presentation from logic. I never got this until today. Thank you 
for this quick lesson!

How come that you guys know all this? You must read books and attend 
classes 24x7.

         David K.

At 08:05 AM 10/14/2006, you wrote:
>To make it even better, separate the control logic from the
>presentation. That way, back could be reverse, etc. I do this in all my
>forms since application logic and presentation "word play" are two
>distinct things to me. This is what I use:
>
><form method="post" action="form.php">
><input name="submit[back]" value="reverse" type="submit" />
>&nbsp;
><input name="submit[next]" value="speed ahead" type="submit" />
>&nbsp;
><input name="submit[home]" value="no place like home" type="submit" />
></form>
>
>Then, you can have a simple routine that captures submit actions
>regardless of the presentation value. You check for the array submit --
>count 1 and whitelist against the acceptable values. A multi-row table
>can expand upon the theme by using this: submit[edit_3],
>submit[delete_3]m submit[edit_5], etc.
>
>Cliff
>-----Original Message-----
>From: talk-bounces at lists.nyphp.org [mailto:talk-bounces at lists.nyphp.org]
>On Behalf Of David Krings
>Sent: Saturday, October 14, 2006 6:48 AM
>To: NYPHP Talk
>Subject: Re: [nycphp-talk] OT?: HTML question
>
>At 09:38 PM 10/13/2006, you wrote:
> >Another possible solution to the whole thing is to just use a named
> >variable inside of the submit itself + switch on that instead of
> >using 3 form blocks:
> >
> ><form method="post" action="form.php">
> ><input name="submit" value="back" type="submit" />
> >&nbsp;
> ><input name="submit" value="next" type="submit" />
> >&nbsp;
> ><input name="submit" value="home" type="submit" />
> ></form>
> >
> >- Jon
>
>
>Yes!! This is what I was hoping for. Sweet, small, easy and on a level
>that
>I can comprehend. Look Ma! No DIVs needed!
>
>This is so straight forward that I am really annoyed that I didn't
>figure
>this out myself.
>
>Thank you very very very much! This makes my day and hopefully will get
>me
>through the trip to the IKEA store. :7
>
>
>          David K.
>
>_______________________________________________
>New York PHP Community Talk Mailing List
>http://lists.nyphp.org/mailman/listinfo/talk
>
>NYPHPCon 2006 Presentations Online
>http://www.nyphpcon.com
>
>Show Your Participation in New York PHP
>http://www.nyphp.org/show_participation.php
>
>_______________________________________________
>New York PHP Community Talk Mailing List
>http://lists.nyphp.org/mailman/listinfo/talk
>
>NYPHPCon 2006 Presentations Online
>http://www.nyphpcon.com
>
>Show Your Participation in New York PHP
>http://www.nyphp.org/show_participation.php




More information about the talk mailing list