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? Quote Link to comment 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) Quote Link to comment 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? Quote Link to comment 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? Quote Link to comment 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 Quote Link to comment Share on other sites More sharing options...
mcas Posted June 26, 2007 Author Share Posted June 26, 2007 ok..Thanks for the advice.. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.