My PHP-based interactive voting system isn't working
<p>I am still new to PHP and trying to create an interactive voting system. I used 2 arrays that hold names in a string. I used </p>

<pre><code>&lt;?php
$array(...,...);
$array2(...,...);
$random = $array; 
$random2 = $array2; 
shuffle($random); 
shuffle($random2);
?&gt;
</code></pre>

<p>to output name randomly. </p>

<p>I then created a form with </p>

<pre><code>&lt;form action="action.php" method="post"&gt;
&lt;input type="button" onclick="window.location.reload()" value="&lt;?php echo array_pop($random);?&gt;" name="name" /&gt;
&lt;/form&gt;

&lt;form action="action.php" method="post"&gt;
&lt;input type="button" onclick="window.location.reload()" value="&lt;?php echo array_pop($random2);?&gt;" name="haventseen" /&gt;
&lt;/form&gt;
</code></pre>

<p>At this point all the names show up randomly in a button to click, and when clicked, 2 new ones show up. The problem I am having is storing the information in the database. Since it is a voting system, I'd like to store them in DB and each time a user clicks on the button +1 is added to that particular name. And when the "haventseen" button is clicked +1 to that name in the button above in the haventseen row. This is how my table is set up:</p>

<p>It is a MySQL 5.0 database.</p>

<pre><code>id INT NOT NULL AUTO_INCREMENT PRIMARY KEY (id)
name VARCHAR(80)
vote INT(11)
haventseen INT(11)
</code></pre>

<p>Here is my code so far.</p>

<pre><code>&lt;?php
 $dbname = "db_name";

    $con=mysql_connect
("local","root","pass");
    if(!$con)
    {
    die ('Could not connect: '.mysql_error());  
    }
    echo ('Connected');

mysql_select_db($dbname, $con);

$sql="INSERT INTO `table_name` (`name`)  VALUES ('{$_POST['name']}')";
$sql="INSERT INTO `table_name` (`name`)  VALUES ('{$_POST['haventseen']}')";

if (!mysql_query($sql, $con))
{
    die('Error: ' . mysql_error());
}
?&gt;
</code></pre>

<p>I'm not really sure where to go from here. But this setup isn't putting anything into the database (I changed some names for this post) even when all the names are correct. Some sample code would be really nice! But if its too much trouble please talk me through some steps I can take.</p>
