I am trying to execute the below code which perfectly returns me an output from database.
<?php if(isset($_POST['submit']))
{
$email = $_POST["Email_i"];
$checkRe = mysql_query("select * from contact_form where email='$email'",$con);
if(mysql_num_rows($checkRe)>0)
{
$check = 1;
}
?>
I am trying to call a function using onSubmit event as follows;
<form action="#" method="post" name="myForm" onSubmit="return CheckForm()">
<input type="submit" name="submit">
</form>
<script type="text/javascript">
function CheckForm()
{
var calc =1;
var Checkre = "<?php
$check="";
echo $check; ?>";
if(calc == Checkre)
{
alert('phone number exists');
return false;
}
}
</script>
the above function does not set the value of $check
hence not resulting into its execution.