PHP Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming LanguagesPHP Development
The ASP Free website provides in-depth information on the latest developer tools available from Microsoft. Our cadre of writers, highly experienced industry experts, reveals the best ways to use established technologies as well as new and emerging technologies. Our coverage of Microsoft's development and administration technologies is among the most respected in the IT industry today.

ASP Free and Iron Speed Designer are giving away $5,500+ in FREE licenses. Iron Speed's RAD CASE toolset can save up to 80% of your coding time. One free license per week, one perpetual license per month!
Download and Activate to enter!

Intel® Graphics Performance Analyzers is a powerful tool suite for analyzing and optimizing your games, media, and graphics-intensive applications. Used by some of the best developers on the planet, Intel GPA lets you maximize your app’s performance.


Tutorials
| Forums

Download to Enter
| Contest Rules

DOWNLOAD INTEL® GPA FOR FREE

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old June 4th, 2002, 12:49 AM
bakul bakul is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2002
Location: Banas Dairy,Palanpur
Posts: 0 bakul User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Send a message via Yahoo to bakul
Question How to store mulitiselected value in php

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

Reply With Quote
  #2  
Old June 4th, 2002, 04:11 AM
zubi zubi is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2001
Posts: 0 zubi User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
<SELECT NAME="Occupation[]" MULTIPLE SIZE=5>

Reply With Quote
  #3  
Old June 4th, 2002, 04:14 AM
sunnychan's Avatar
sunnychan sunnychan is offline
a lazy guy
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2001
Location: Hong Kong
Posts: 99 sunnychan User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 11
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:
// parse the selected value
$selectedValueArr explode("x"$FORM_SELECTED_VALUE);

// print the result
print_r($selectedValueArr);
...
...
... 

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming LanguagesPHP Development > How to store mulitiselected value in php


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.

© 2003-2012 by Developer Shed. All rights reserved. DS Cluster 10 - Follow our Sitemap