Forum Moderators: coopster
<?php
include "connect.php";
$s=$_SERVER["REMOTE_ADDR"];
$ipcheck="SELECT * FROM P_ip where IP='$s'";
$ipcheck2=mysql_query($ipcheck);
while($ipcheck3=mysql_fetch_array($ipcheck2))
{
$ip=$ipcheck3[IP];
}
if($ip)
{
print "Thank you for voting in our poll";
}
else
{
$pollquest="SELECT*From P_question";
$p2=mysql_query($pollquest);
while($p3 = mysql_fetch_array($p2))
{
print "$p3[question] <br>";
}
$pollans="Select * from P_choices";
$pollans2=mysql_query($pollans);
print "<form action='wp-content/themes/matchbox1.1/pollit.php' method='post'>";
print "<input name='redirect' value='/' type='hidden'>";
while($pollans3=mysql_fetch_array($pollans2))
{
print "<input type='radio' name='answer' value='$pollans3[ID]'> $pollans3[answer]<br>";
}
print "<input type='submit' value='submit' value='vote'>";
print "</form><br>";
}
?>
<?php
include "connect.php";
$s=$_SERVER["REMOTE_ADDR"];
$ipchecks="SELECT*from P_ip where IP='$s'";
$ipchecks2=mysql_query($ipchecks);
while($ipchecks3=mysql_fetch_array($ipchecks2))
{
$isip=$ipchecks3[IP];
}
if($isip)
{
print "Thank you for voting in our poll";
}
else
{
$ID=$_POST['answer'];
$ipinsert="Insert into P_ip(IP) VALUES('$s')";
mysql_query($ipinsert);
$vote = "UPDATE P_choices SET votes=votes+1
WHERE ID = '$ID'";
mysql_query($vote);
print "Thanks for voting, <a href='poll.php'>Back to Home</a>";
}
?>
What is it you want to do? It seems when they hit submit, they are thanked for voting, and presented with a back to home link.. This isnt what you want?
The only spot i can see is
if($isip)
{
print "Thank you for voting in our poll";
}
Maybe add a home link there?