Dear friend,
i have 2 tab 1) atab 2) qtab.. when i put question and options answers ..
i use three forms qset.php, Ans.php and result.php here are code
what i want that email of user updated after click button submit
code is below ans.php
<?PHP include "conn.php";
//session_start();
?>
<!DOCTYPE HTML>
<html>
<head>
<title>Answer Section</title>
</head>
<body style="color: #6ACCCB; background-color: #3C8924">
<h1 style="color: #C4CCC4; background-color: #3F5ECC; width: 30%">Answer Section</h1>
<form action="result.php" method="GET">
<?PHP
$sql="SELECT * FROM qtab ORDER BY Qid DESC Limit 1";
$result=$conn->query($sql);
if(!$result){
die($conn->error);
}
While($row=$result->fetch_assoc()){
echo "<BR>"."Question: ".$row["Question"]." ?"."<BR>"."<BR>";
//fetch data from atab table
$sqla="SELECT * FROM atab ORDER BY Qid DESC Limit 1";
$resulta=$conn->query($sqla);
if(!$resulta){
die($conn->error);
}
While($rowa=$resulta->fetch_assoc()){
?>
<P>
<?PHP echo $row['AnsA']; ?> :<input type="radio" name="q" value="AnsA" /> <BR></br>
<?PHP echo $row['AnsB']; ?> :<input type="radio" name="q" value="AnsB" /><BR></br>
<?PHP echo $row['AnsC']; ?> :<input type="radio" name="q" value="AnsC" /> <BR></br>
<input type="text" name="hid" value="<?php echo $rowa['Qid']; ?>" />
Enter your Email address:<input type="text" name="email" value="<?php echo $rowa['email'];} ?>" /> <br></br>
<input type="submit" name="submit" value="Submit" />
</p>
</form>
</body>
<?php
}
$conn->close();
?>
</html>
and result.php
<?php
include "conn1.php";
if(isset($_GET['submit']) && isset($_GET['q'])){
$answer=$_GET['q'];
$hid=$_GET['hid'];
$mail="9jjk";
echo($mail)."<br>";
//if($row=($sql->num_rows()>1)){
$sqlu="UPDATE atab
SET
email=$mail,
$answer=$answer+1
WHERE Qid=$hid";
$result=$conn->query($sqlu);
if ($result){
echo("user has voted");}
else {
echo("Error") ;
}
}
?>
Only numarical data updated...in mail=$email
plz guid me