Hey Ernest.

This looks like the solution I'll need to make my CF interface work in PHP.

I'll check it out.

Thanks!

--Noah


----- Original Message -----
From: "Ernest E Vogelsinger" <[EMAIL PROTECTED]>
To: "CF High" <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>
Sent: Sunday, February 09, 2003 6:39 AM
Subject: Re: [PHP] Why does this happen?


> At 04:52 09.02.2003, CF High said:
> --------------------[snip]--------------------
> >In this test form when I submit and insert into my db, only the last
select
> >field get entered; i.e. in this case the day value of 25.
> >
> ><form name="form1" method="post" action="">
> >
> >Year
> ><select name="date" onSelect="return check_submit()">
> >    <option selected value=2002>2002</option>
> ></select>
> >
> >Month
> ><select name="date">
> >    <option selected value=12>12</option>
> ></select>
> >
> >Day
> ><select name="date">
> >    <option selected value=25>25</option>
> ></select>
> >
> ><input type="submit" name="textfield">
> >
> ></form>
> >
> >Why does this happen?  In Cold Fusion I'm able to refer to the three
selects
> >as #date# and it returns 20021225 as expected.
> --------------------[snip]--------------------
>
> I don't know much about CF, but in plain HTML as you show here you have 3
> different form input (select) fields sharing the same name. Thus the
> browser will transmit only one of the three input (select) fields upon
> submit (it is undefined which field will be sent, but most browsers will
> transmit the last value).
>
> Maybe CF fiddles around with the element names, PHP doesn't. You could
e.g.
> format the 3 elements to transmit an array, something like this:
>
> <form name="form1" method="post" action="">
> Year
> <select name="date[Y]" onSelect="return check_submit()">
> <option selected value=2002>2002</option>
> </select>
> Month
> <select name="date[M]">
> <option selected value=12>12</option>
> </select>
> Day
> <select name="date[D]">
> <option selected value=25>25</option>
> </select>
> <input type="submit" name="textfield">
> </form>
>
> In your receiving script you would have an associative array named "date"
> in the $_REQUEST structure:
>
> $date_received = $_REQUEST['date'];
> $year = $date_received['Y'];
> $month = $date_received['M'];
> $day = $date_received['D'];
>
> HTH,
>
>
> --
>    >O     Ernest E. Vogelsinger
>    (\)    ICQ #13394035
>     ^     http://www.vogelsinger.at/
>
>


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to