Link to home
Start Free TrialLog in
Avatar of adrake9
adrake9

asked on

Can I pass multiple variables through a list menu in Dreamweaver

I have a list menu that has the following choices
1-100
101-200
201-300
etc.,.....

In mySQL statement I need to get those 2 values in my BETWEEN var1
AND var2 condition.

Dreamweaver has the ability to pass a value through the selection, but how do I pass multiple values through the list menu? can I separate them through commas? Brackets?
Any help is appreciated.
-A
ASKER CERTIFIED SOLUTION
Avatar of yessirnosir
yessirnosir

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of yessirnosir
yessirnosir

probably obvious, but above code may have to be changed to use .php extension; I've got my system setup to interpret .htm with php so I forget about that sometimes.
Avatar of adrake9

ASKER

If I am using these numbers in a mySQL statement will the values that are split end up as a string or a integer? If there a string my WHERE statement in mySQL would need something numeric to be able to carry out a =, or a <= or a BETWEEN - AND statement?
re: "will the values that are split end up as a string or a integer"?
Since php is what they call "loosely typed", I think you'll find that you'll be able to use the data as either number or text.  eg. try the code below -- you can do a mathematical operation on var1 and var2 and then immediately do a string operation on them.   When you add the variable to a database, I think the variable type will adjust to whatever the database column type is, i.e. integer, char, etc.   If you find you have any problem with type mismatch, it is possible to force the type, eg. $var1 = (Integer)$var2, see this for more info: http://hudzilla.org/phpwiki/index.php?title=Forcing_a_type_with_type_casting 
$value = $_POST['mydatarange'] ;
$value_split = split("-",$value);
$var1 = $value_split[0];
$var2 = $value_split[1];
$var3 = $var1 + $var2;
$var4 = $var1.$var2;
?>
<p><?php echo "Var 1 is: ".$var1; ?></p>
<p><?php echo "Var 2 is: ".$var2; ?></p>
<p><?php echo "Sum is: ".$var3; ?></p>
<p><?php echo "Concat is: ".$var4; ?></p>

Open in new window

Avatar of adrake9

ASKER

Thanks for the follow up. Very clear explanation. I did get it to work perfectly. I'm just a newbie, but this is kinda like art. Give a person the canvas and the brush, and you can create just about anything! Brilliant
-a