?
Solved

Can I pass multiple variables through a list menu in Dreamweaver

Posted on 2008-10-07
5
Medium Priority
?
296 Views
Last Modified: 2012-05-05
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
0
Comment
Question by:adrake9
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
5 Comments
 
LVL 14

Accepted Solution

by:
yessirnosir earned 2000 total points
ID: 22666264
Try the approach below:  the ranges can be output from the form as a delimited string and then split into the component parts with the split() function.  eg. in the code below, I just used ranges like you did:  1-100, 101-200, etc.

Note that you could also do something like
<option value="1-100">Any Text String Here</option>
if you want to use one string for the user to see, but actually send your variables as a different string.
<!-- save this document as mypage.htm   -->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Pass Two Variables from List Menu </title>
</head>
 
<body>
<?php 
$value = $_POST['mydatarange'] ;
$value_split = split("-",$value);
$var1 = $value_split[0];
$var2 = $value_split[1];
?>
<p><?php echo "Var 1 is: ".$var1; ?></p>
<p><?php echo "Var 2 is: ".$var2; ?></p>
<form action="mypage.htm" method="post">
<select name="mydatarange" >
  <option value="#" >Choose a Range</option>
  <option>1-100</option>
  <option>101-200</option>
  <option>201-300</option>
 
</select>
<input type="submit" value="Submit Form">
</form>
</body>
</html>

Open in new window

0
 
LVL 14

Expert Comment

by:yessirnosir
ID: 22666348
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.
0
 
LVL 2

Author Closing Comment

by:adrake9
ID: 31504206
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?
0
 
LVL 14

Expert Comment

by:yessirnosir
ID: 22668934
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

0
 
LVL 2

Author Comment

by:adrake9
ID: 22669326
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
0

Featured Post

New benefit for Premium Members - Upgrade now!

Ready to get started with anonymous questions today? It's easy! Learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

For those who don't know, Adobe Dreamweaver is a popular commercial web editor that enables you to design, build and manage complex websites. The editor is a WYSIWYG (What You See Is What You Get) web editor, which means that you can create your web…
Adobe Dreamweaver CS5 is a WYSIWYG web page editor that has advanced HTML, CSS, and Javascript rendering functionality and is probably the most well-known HTML editor available. Much of Dreamweaver's appeal centers around the Design View interfac…
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…
Suggested Courses
Course of the Month9 days, 17 hours left to enroll

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question