Jump to content

Update MYQSL with Radio Value


doddsey_65

Recommended Posts

I am trying to update a column in the table with the selected radio value. This is for a rating system i am trying to create but it isnt working. No value is entered into said column.

 

<form name=rate action="<?php echo $_SERVER['PHP_SELF']?>?id=6" method="POST">

<input type=radio name=rate value=1>1
<input type=radio name=rate value=2>2
<input type=radio name=rate value=3 checked>3
<input type=radio name=rate value=4>4
<input type=radio name=rate value=5>5
<input type=submit name=rate value=Rate id=rate><br>
</form>

<?php

$update = $_POST['rate'];

if (isset($_POST['rate'])) {

$rated = mysql_query("UPDATE tutorials SET RatedBy = RatedBy + 1, Rating = Rating + '$update' WHERE id = 6") or die 

(mysql_error());
$res = mysql_query($rated);

 

Anyone know where Im going wrong?

Link to comment
https://forums.phpfreaks.com/topic/196032-update-myqsl-with-radio-value/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.