matthewst Posted June 11, 2007 Share Posted June 11, 2007 It always says "nothing in text box" <input type="text" class="formSmallTextbox" name="a_number" size="4" value="<?="$a_number"?>"> <input type="submit" name="submit" class="formTextbox" value="Submit" onClick="<?php if ($qty_oak >= '1'){ echo "return confirm('something in text box')\">";} else{ echo "return confirm('nothing in text box')\">";} ?> Quote Link to comment Share on other sites More sharing options...
matthewst Posted June 11, 2007 Author Share Posted June 11, 2007 It just occurred to me that when the page loads the text box a_number is always empty thats why it echos "nothing in text box". How do I get php to recognize that something was put in the text box after the page was loaded? Quote Link to comment Share on other sites More sharing options...
trq Posted June 11, 2007 Share Posted June 11, 2007 PHP is server side, so the onclick (Javascript) meens nothing to it. What exactly are you trying to do? Quote Link to comment Share on other sites More sharing options...
tarun Posted June 11, 2007 Share Posted June 11, 2007 You Could Use Ajax...? Quote Link to comment Share on other sites More sharing options...
matthewst Posted June 11, 2007 Author Share Posted June 11, 2007 thanks raffels (sitepoint) <input type="text" class="formSmallTextbox" name="a_number" size="4" value=""> <input type="submit" name="submit" class="formTextbox" value="Submit" onClick="if (document.getElementsByName('a_number')[0].value == '') return confirm('nothing in text box'); else return confirm('something in textbox');"> 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.