By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,963 Members | 2,122 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,963 IT Pros & Developers. It's quick & easy.

getting a drop down list value with php?

P: 16
I am trying to grab the values of a couple drop down lists. Now i know what i have isn't right, but i feel close.

<select name="os1">
<option value="1">1
<option value="2">2
<option value="3">3
</select>

<select name="os2">
<option value="a">a
<option value="b">b
<option value="c">c
</select>

<?php
$min=300;

if(os1.value == 1 && os2.value == b){
echo "$min";
}
?>
Jan 9 '08 #1
Share this Question
Share on Google+
3 Replies


Markus
Expert 5K+
P: 6,050
Looks like you're confused..

Are you wanting to use javascript or php? One or the other..
Jan 9 '08 #2

P: 16
php if possible, thanks
Jan 9 '08 #3

Markus
Expert 5K+
P: 6,050
Well then you'd have to send the option stuff through a form.
Expand|Select|Wrap|Line Numbers
  1. <form action="" method="post">
  2. /*
  3.   Stuff for options
  4.   Goes here
  5. */
  6. <input type="submit">
  7. </form>
  8.  
Then, in the same page
[php]
$select = $_POST['select_name'];
if($select == "something"){
// code..
}
[/php]
Jan 9 '08 #4

Post your reply

Sign in to post your reply or Sign up for a free account.