Please help me to see what's wrong if & nbsp ;(! Isset ($ _ SESSION [sn]) {$ _ SESSION [sn] 0; setcookie (sn, $ sn, time () + 1); & nbsp; & nbsp; if ($ _ POST [submit]) {if ($ sn3) {alert (sorry, you have clicked it three times ); locat, please help me see what's wrong
if (!isset($_SESSION["sn"])){
$_SESSION['sn']=0;
setcookie('sn',$sn,time()+1);
if($_POST["submit"]){
if($sn=3)
{
Alert ("Sorry, you have already clicked 3 times ");
Location. href = "zp. php ";
exit();
}
elseif ($sn=="tull")
{
alert("123");
location.href="zp.php";
exit();
}
$newitem=$_POST["zp_user"];
$sql="insert into vote (awards,sn,pnone) values (1,'$sn',1)";
if(mysql_query($sql))
{
$sn==$_SESSION['sn']+1;
}}
if($_POST["submit2"]){
if(empty($_POST['sn']))
$_SESSION['zp_user']=$_POST['pnone'];
$sql="insert into zp_user values('".($_POST['sn'])."')";
if(mysql_query($sql))
{
}
}}
------ Solution --------------------
If (mysql_query ($ SQL ))
{
$ Sn = $ _ SESSION ['SN '] + 1;
}
Why =?
------ Solution --------------------
How can code be separated ......
------ Solution --------------------
If ($ _ POST ["submit"]) {
If ($ sn = 3)
Should be =
------ Solution --------------------
If ($ _ POST ["submit"]) {
If ($ sn = 3) // =
{
------ Solution --------------------
= Yes value assignment
= If condition judgment is used