f.ismayil Posted April 20, 2011 Share Posted April 20, 2011 I have the following code for validation of input text: <?php echo "<form method='POST' action='oversikt.php' onsubmit='return checkform(this);'>"; echo "<input type=text name=A2>"; echo "</form>"; ?> <script language="JavaScript" type="text/javascript"> <!-- function checkform ( form ) { // see http://www.thesitewizard.com/archive/validation.shtml // for an explanation of this script and how to use it on your // own website // ** START ** if (form.A2.value == "") { alert( "Please, fill in all required fields" ); form.A2.focus(); return false ; } // ** END ** return true ; } //--> </script> When user don't type text in A2 textbox user receives a notification but after clicking OK, page forwards user into oversikt.php. What I need is not to change URL of current page if user doesn't type text in textfield.If he typed text in textboxe to change URL into oversikt.php Link to comment https://forums.phpfreaks.com/topic/234225-input-text-validation/ Share on other sites More sharing options...
Skewled Posted April 21, 2011 Share Posted April 21, 2011 echo "<input type='text' name='A2'>"; you forgot to add ' to text and A2 Link to comment https://forums.phpfreaks.com/topic/234225-input-text-validation/#findComment-1204333 Share on other sites More sharing options...
f.ismayil Posted April 21, 2011 Author Share Posted April 21, 2011 No kadeous. Input part exists inside code. I just do not show it here. Cause in this case code will be very big. Link to comment https://forums.phpfreaks.com/topic/234225-input-text-validation/#findComment-1204365 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.