RE: Problem with form

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

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


[Index of Archives]     [PHP Home]     [PHP Users]     [PHP Database Programming]     [PHP Install]     [Kernel Newbies]     [Yosemite Forum]     [PHP Books]

  Powered by Linux