Working out a simple star ratings script. Data not inserting into SQL. I am passing a 'id' in the url from the form action to coincide with the rating. I'm using GET to retreive that value. I'm using POST to insert the radio button value. I've tested and the url is passing the id. The script runs to completion. SQL is connecting.
index.html
<form method="POST" action="rating.php?id=<?php echo $id; ?>">
<fieldset class="rating">
<legend>. . .</legend>
<input type="radio" id="star3" name="starno" value="3" onclick="this.form.submit()"/>
<label for="star3" title="Meh">3 stars</label>
<input type="radio" id="star2" name="starno" value="2" onclick="this.form.submit()"/>
<label for="star2" title="Kinda bad">2 stars</label>
<input type="radio" id="star1" name="starno" value="1" onclick="this.form.submit()"/>
<label for="star1" title="Sucks big time">1 star</label>
</fieldset>
</form>
ratings.php
<?php
isset($_GET['id']);
$con=mysqli_connect ("","","","");
mysqli_query($con,"INSERT INTO ratings (storyidr, rank, entry_date) VALUES ('$_GET[id]','$_POST[starno]',now())");
mysqli_close($con);
header('Location: http://www.website.com/');
?>
SQL
CREATE TABLE IF NOT EXISTS `ratings`
(
`ratingid` int(11) NOT NULL AUTO_INCREMENT,
`storyidr` varchar(11) NOT NULL,
`rank` int(11) NOT NULL,
`entry_date` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
PRIMARY KEY (`ratingid`),
UNIQUE KEY `ratingid` (`ratingid`)
)
ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='rating for stories' AUTO_INCREMENT=1