mcas Posted June 26, 2007 Share Posted June 26, 2007 I'm trying for 2 days now to create a simple calculator that will display different units(factors) based on selections chosen from a dropdown menu.... so, if a user chooses option "a" from the dropdown...the unit factor will be displayed on the next line next to the input box... and so on if they choose option "b"... I've tried unsuccessfully $get_mdb=mysql_query("SELECT * FROM mnamedb WHERE unit='$green[0]' ORDER BY id ASC",$link ) or die(mysql_error()); and similar codes... by the way, is there something similar to frontpage for html testing to be found anywhere for php code and display? Link to comment https://forums.phpfreaks.com/topic/57318-solved-dropdown-menus-and-if/ Share on other sites More sharing options...
mcas Posted June 26, 2007 Author Share Posted June 26, 2007 if ($_POST[menu]==1) $unit1="selected"; echo'<tr><td align"left">yes</td>'; if ($_POST[menu]==2) $unit2="selected"; echo'<tr><td align"left">no</td>'; echo'<td><input class="inputp" name="'.$m_num.'" type="text" size="5" maxlength="5" value="'.$_POST[$m_num].'"></td></tr>'; oops...posted the $get_ instead of where I'm lost...I've tried 'else' in between the 'if' statements and that doesn't work....can someone tell me what I'm missing? In case you cant tell I am a bit of a n00b without my frontapge to show me how it looks and acts..lol Thanks, lostincode (lol) Link to comment https://forums.phpfreaks.com/topic/57318-solved-dropdown-menus-and-if/#findComment-283399 Share on other sites More sharing options...
corillo181 Posted June 26, 2007 Share Posted June 26, 2007 what you trying to do is done by javascript.. you want instanly to appear after they choose one? Link to comment https://forums.phpfreaks.com/topic/57318-solved-dropdown-menus-and-if/#findComment-283411 Share on other sites More sharing options...
mcas Posted June 26, 2007 Author Share Posted June 26, 2007 yes...and can I check javascript somewhere to see it working? Link to comment https://forums.phpfreaks.com/topic/57318-solved-dropdown-menus-and-if/#findComment-283420 Share on other sites More sharing options...
corillo181 Posted June 26, 2007 Share Posted June 26, 2007 well i dont like java script so i came up with a way to do that with php but it requires for the form to submit over and over again until the last submit bottom is click on your select menu use the onchange="submit();" and set the variable on the top page so when it's submit you get the value so $value next just echo it next to the selection Link to comment https://forums.phpfreaks.com/topic/57318-solved-dropdown-menus-and-if/#findComment-283428 Share on other sites More sharing options...
mcas Posted June 26, 2007 Author Share Posted June 26, 2007 ok..Thanks for the advice.. Link to comment https://forums.phpfreaks.com/topic/57318-solved-dropdown-menus-and-if/#findComment-283443 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.