Muncey Posted May 17, 2007 Share Posted May 17, 2007 Ok im not new to PHP but i was a beginner and i stopped for a few months to study.. and now it's just totally gone. <form action="" method="post"> <table align="left" border="0" cellspacing="0" cellpadding="3"> <tr><td>Password:</td><td><input type="text" name="pass" maxlength="30"></td></tr> <tr><td colspan="2" align="left"><input type="submit" name="sublogin" value="Login" onclick="checkpass()"></td></tr> </table> </form> <br /><br /> <?php function checkpass(){ echo "lol"; if($pass == ""){ echo "<br /><br /><br />Correct!"; } else { echo "<br /><br /><br />Try Again!"; } } ?> Basically when i click submit i want it to run the function and then display the echo. This worked when i did it without the function but obviously the pass box is empty when the page is opened so it already displays Correct! so i need it to show the text after the submit button has been pressed. Thanks in advance. Quote Link to comment https://forums.phpfreaks.com/topic/51887-function-help/ Share on other sites More sharing options...
Orio Posted May 17, 2007 Share Posted May 17, 2007 <?php if(isset($_POST['sublogin)) { //call the function } ?> Orio. Quote Link to comment https://forums.phpfreaks.com/topic/51887-function-help/#findComment-255767 Share on other sites More sharing options...
Muncey Posted May 17, 2007 Author Share Posted May 17, 2007 Thanks a lot! Quote Link to comment https://forums.phpfreaks.com/topic/51887-function-help/#findComment-255779 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.