|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Dear Sir,
I had made web application using php and postgresql. I want to use mulitple selection box. Please send me how can i know where user select mulitple value and submit form. Because I have to store all selected values. I had asp code which is pasted below but for php what is coding i donot know plese help me. mail at : URL, URL Listing 35.3 multi.htm--One of the Fields of This Form May Have Multiple Values <FORM METHOD="GET" ACTION="doMulti.asp"> <BR>First name: <INPUT TYPE="text" NAME="first"> <BR>Last name: <INPUT TYPE="text" NAME="last"> <BR>Occupation (select all that apply): <SELECT NAME="Occupation" MULTIPLE SIZE=5> <OPTION Executive>Executive <OPTION Professional>Professional <OPTION Engineer>Engineer <OPTION Skilled>Skilled Labor <OPTION Clerical>Clerical </SELECT> <BR><INPUT TYPE="submit" VALUE="Enter"> </FORM> Listing 35.4 doMulti.asp--Use This ASP Script to Read the Values from "Occupation" <%@ Language = VBScript %> <HTML> <HEAD><TITLE>Welcome</TITLE></HEAD> <BODY> <H1>Welcome</H1> <P>Hello, <%= Request.QueryString("first") %> <%= Request.QueryString("last") %> </P> <P>Welcome to my site.</P> <P> <% theNumberOfOccupations = Request.QueryString("Occupation").Count %> <% if theNumberOfOccupations = 0 %> You must be unemployed <% else if theNumberOfOccupations = 1 %> Your occupation is <% Request.QueryString("Occupation")(1) %> <% else %> Your occupations are <% Request.QueryString("Occupation")(1) %> <% For i = 2 to theNumberOfOccupations - 1 %> ,<% Request.QueryString("Occupation")(i) %> <% Next %> and <% Request.QueryString("Occupation")(theNumberOfOccupation s) %> <END IF> .</P> <P><A HREF="next.htm">Next</A></P> </BODY> </HTML> waiting for favourable reply, Bye... regards, bakul |
|
#2
|
|||
|
|||
|
<SELECT NAME="Occupation[]" MULTIPLE SIZE=5>
|
|
#3
|
||||
|
||||
|
Here is a work around method
use javascript to store the selected values into a hidden variable before submit. eg. Code:
<input type="hidden" name="FORM_SELECTED_VALUE">
<script>
function sumup(mylist)
{
var selected_value = "";
for (var i=0; i < mylist.options.length; i++)
{
var o = mylist.options[i];
if (o.selected)
{
selected_value += "x" + o.value;
}
}
document.myform.FORM_SELECTED_VALUE = selected_value;
}
</script>
PHP Code:
|
![]() |
| Viewing: Dev Shed Forums > Programming Languages > PHP Development > How to store mulitiselected value in php |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|