RE: [PHP-WIN] Problem with form
| From: | Disko_kex | Date: | Thu, 05 Feb 2004 15:28:09 +0000 |
| Subject: | RE: [PHP-WIN] Problem with form | ||
| References: | 1 | Groups: | php.windows |
| Request: | Send a blank email to php-windows+get-22738@lists.php.net to get a copy of this message | ||
Its not the progress of the form that's the problem. If a want to post
more the one value in a "<select>" the name must be "name =
"something[]" in php, but if the <select> is named with "[]" my
javascripts doesn't understand the name. So it's a javascript question.
This works:
<select Onchange="updateOrter(this.value,document.form_lediga.omr);">
//update "omr"
<select name="omr">
but then only one value from "omr" is posted with PHP
How can I get this work:
<select Onchange="updateOrter(this.value,document.form_lediga.omr);">
<select name="omr[]">
> -----Original Message-----
> From: John Ellingsworth [mailto:jellings@mail.med.upenn.edu]
> Sent: den 5 februari 2004 16:10
> To: Disko_kex; php-windows@lists.php.net
> Subject: RE: [PHP-WIN] Problem with form
>
> Is your question a javascript or PHP question?
>
> For PHP you can do this:
>
> $omr = $_POST['omr'] ;
> if(is_array($omr))
> {
> for($k=0; $k<count($omr); $k++)
> ` {
> $sql->Insert("insert into omr (omrID,omrNumber)
> values
> ('$omrID','$omr[$k]')");
> $affected_rows = $sql->a_rows;
> }
>
> if ($affected_rows == 1)
> {
> echo "omr <font color=red>". $omrID .
> "</font> omr successfully added to
> the database.\n<BR />";
> } else {
> echo "omr <font color=red>". $omrID .
> "</font> omr was not successfully
> added to the database.<BR />Please try again.\n<BR />";
> }
>
> }
>
>
>
> Thanks,
>
> John Ellingsworth
> http://mail.med.upenn.edu/~jellings/
> AIM: vc2000support
>
> -----Original Message-----
> From: Disko_kex [mailto:disko_kex@swedish-mushroom.com]
> Sent: Thursday, February 05, 2004 10:04 AM
> To: php-windows@lists.php.net
> Subject: [PHP-WIN] Problem with form
>
>
> Hi
>
> If a have a <select name="omr[]">, what is the name of the "select"?
> I
> tried with both "omr" and "omr[]", but no one works. It works fine if
> the name is "omr" but then it is only one value posted.
>
> Maybe its easier to understand if you see it yourself:
> http://www.lokalguiden.se/index2.php?action=ledigalokaler
> It's the second select I must name omr[] to get all the values posted
> but then the javascript doesn't understand the name omr[], what to do?
>
> Thx.
>
> --
> PHP Windows Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php