Jump to content

Input text validation


f.ismayil

Recommended Posts

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.