28, May 2012

Pass multi values using ComboBox - webmaster forum

 
Webdigity webmaster forums
[ Home | Help | Search | Forum's Shop | Archive | Login | Register | Webmaster Directory ]
Webdigity Webmaster Forums  >  Web Development  >  PhP
Topic: Pass multi values using ComboBox
« previous next »
Pages: [1] Print
Instabuck - The easy way to sell digital products online

Author Topic: Pass multi values using ComboBox  (Read 1750 times)
Guest


Email
« on: Mar 22, 2007, 12:44:22 am »

hello ,

 i want to pass multi values using comboBox.i have two values from database 1st(ModelID) , 2nd(ModelName) , i displayed the  2nd(ModelName) value using combobox .i want to send the both values (ModelID,ModelName) , when user select the the ModelName using ComboBox..

I am a metal monkey!
Administrator
Community Supporter ?
Jedai Sword Master
*****
Gender: Male
Posts: 5799
46391 credits
Members referred : 3



« Reply #1 on: Mar 22, 2007, 07:08:00 am »

Can you post an example of your code?

I don't understand what the problem is.

Trial and Error my two best teachers Cool
Join us @ facebook or twitter

Last blog : Butterfly Marketing 2.0
Global Moderator
Community Supporter ?
Jedai Sword Master
*****
Gender: Male
Posts: 6691
34714 credits
Members referred : 374


It's time to use PHP5!


« Reply #2 on: Mar 22, 2007, 08:10:41 am »

Can you post an example of your code?

I don't understand what the problem is.

he wants to create a cascade select menus, but first he needs to post some code Wink

Guest


Email
« Reply #3 on: Mar 22, 2007, 09:01:40 pm »

Thanx Olaf & Nikolas

Code:
<?php
$modelname 
= array('Toyota''Suzuki''BMW'); 
$modelid = array('25''40''55');
$both = array();
$arrays = array('modelid' => $modelname);
foreach(
$arrays as $key => $value)
{
$both = @array_combine($modelid$value);
} //i combined both arrays
echo("<form action='nextpage.php' method='POST'>");
echo(
"Select Model Name:");
echo(
"<SELECT name=opt[]>");
foreach(
$both as $key => $value)
{
             echo("<option value='$key' >");
 echo($value);
 echo("</option>");
}
        echo("</Select>");
echo("<br>");
echo(
"<input type='submit' value='send..'>");
echo(
"</form>");
?>

My Question
First i combined both arrays($modelname , $modelid) ,the values of $modelid is used as a key of $modelname array .When User Select  Suzuki from the combobox ,the $key(40) and $value(Suzuki) both pass to "nextpage.php"
I am a metal monkey!
Administrator
Community Supporter ?
Jedai Sword Master
*****
Gender: Male
Posts: 5799
46391 credits
Members referred : 3



« Reply #4 on: Mar 23, 2007, 09:48:59 am »

First you don't need this :

$modelname = array('Toyota''Suzuki''BMW'); 
$modelid = array('25''40''55');
$both = array();
$arrays = array('modelid' => $modelname);
foreach(
$arrays as $key => $value)
{
$both = @array_combine($modelid$value);

?>


Instead of that you can use :

 $both = array ( 25 => 'Toyota'40 => 'Suzuki'55 => 'BMW' );?>

Then you should post those to the same page, and in that way the passed value will be :

 echo $_POST['opt'] . ' --> ' $both$_POST['opt'] ]; ?>

Trial and Error my two best teachers Cool
Join us @ facebook or twitter

Last blog : Butterfly Marketing 2.0
Guest


Email
« Reply #5 on: Mar 23, 2007, 01:30:05 pm »

Thanx Nikolas ,

I is working on the same page , i want to send the values to other page , is it possible..
I am a metal monkey!
Administrator
Community Supporter ?
Jedai Sword Master
*****
Gender: Male
Posts: 5799
46391 credits
Members referred : 3



« Reply #6 on: Mar 23, 2007, 01:37:31 pm »

Then you should just need to define the $both array to both of the files Smiley

Trial and Error my two best teachers Cool
Join us @ facebook or twitter

Last blog : Butterfly Marketing 2.0
Guest


Email
« Reply #7 on: Mar 23, 2007, 04:52:07 pm »

Thanx  Nikolas ,

It is working Propery . I will remember your  guidance forever.I am so thankful to you ..
I am a metal monkey!
Administrator
Community Supporter ?
Jedai Sword Master
*****
Gender: Male
Posts: 5799
46391 credits
Members referred : 3



« Reply #8 on: Mar 24, 2007, 07:39:26 am »

Thanx  Nikolas ,

It is working Propery . I will remember your  guidance forever.I am so thankful to you ..

Don't worry man. That's how things work in the open source community. Today I help you, tomorrow you will help me Wink

Trial and Error my two best teachers Cool
Join us @ facebook or twitter

Last blog : Butterfly Marketing 2.0
Trackback URI for this entry : http://www.webdigity.com/trackback.php?topic=6278
Tags : Multi values with combobox proble in send multi values Bookmark this thread : Digg Del.icio.us Dzone more....

Pages: [1] Print 
Webdigity Webmaster Forums  >  Web Development  >  PhP
Topic: Pass multi values using ComboBox
« previous next »
Jump to:
User Area
Welcome, Guest. Please login or register.
Did you miss your activation email?
May 28, 2012, 07:00:17 pm





Login with username, password and session length

Donate to our community, and get a permanent link back to your site!

Donate to our community, and get a permanent link back to your site!






Web Design Gallery · Whois Lookup · Pagerank · Tag Browsing · Lo-fi version · Syndication · Webmaster forum history · Advertise
Developed by HumanWorks © 2005 - 2012 Webdigity webmaster community · sublime directory
Webdigity Webmaster Forums | Powered by SMF 1.0.12. © 2001-2005, Lewis Media. All Rights Reserved.