Hello there
I want to assign javascript variable value to a php variable so that I can use that php variable in mysql query. I dont know how to do it.
I am receiving a value from a prompt box(using javascript) and i want that value to be entered into the database.
Kindly help me.
Here is my code:
I want to assign javascript variable value to a php variable so that I can use that php variable in mysql query. I dont know how to do it.
I am receiving a value from a prompt box(using javascript) and i want that value to be entered into the database.
Kindly help me.
Here is my code:
Code:
<?php
if(isset($_GET['comp_no']))
{
$complaint_no=$_GET['comp_no'];
?>
<script>
function myFunction() {
var person = prompt("Enter your name","John Smith");
}
</script>
<?php
if(isset($_POST['prog']))
{
$prog_name=$_POST['prog'];
}
$query2="update sys_complaints set checked='yes', programmer='$prog_name' where sno='$complaint_no'";
$run_query2=mysql_query($query2);
if($run_query2)
{
echo "<script>alert('Complaint is attended!');</script>";
header("location:view_complaints.php");
}
else
{
echo "Query failed!".mysql_error();
}
}
?>