Hi all
I wonder if someone can help me I have a table named 'choose' with the fields site_id, user_id and values, with 2 rows :
row1 :
site_id = 1
user_id = 2
value = 0
row2 :
site_id = 4
user_id = 2
value = 0
I use the following form, that get's it's info from another table
choose_form.php
<?
include "db.php";
$cookie_info = explode("-", $_COOKIE['cookie_info']); //Extract the Data
$name = $cookie_info[0];
$pass = $cookie_info[1];
$sql_userid = "SELECT userid FROM users WHERE username = 'user2'";
$result_userid = mysql_query($sql_userid);
while($rows=mysql_fetch_array($result_userid)){
$id = $rows[0];
// echo "$id";
}
$sql = "SELECT *
FROM sites
INNER JOIN choose
ON sites.site_id = choose.site_id
WHERE choose.user_id = $id
AND choose.value = '0'";
?>
<table border="1">
<tr>
<td width = "100">Link</td>
<td width = "200">Description</td>
<td width = "30">PR</td>
<td width = "75">Add/Deny</td>
</tr>
<form action = "" method = "post">
<?
$result = mysql_query($sql);
while($rows=mysql_fetch_array($result)){
echo "<tr><td><a href = http://" .
$rows['url'] .
">" .
$rows['title'] .
"</a></td><td>" .
$rows['description'] .
"</td><td>" .
$rows['PR'] .
"</td><td>Add<br>Deny" .
"</td><td>ADD <input type='radio' name='choice[" .
$rows['site_id'] .
"]' value='1'><br>
DENY <input type='radio' name='choice[" .
$rows['site_id'] . "]' value='2'>
<input type = 'text' name = 'site' value = '" . $rows['site_id'] . "'><br></td></tr>"
;}
?>
</table>
<input type = "submit" name = "submit" value = "Update">
</form>
and I use this form to manipulate choose_form.php
<?
include "db.php";
include "choose_form.php";
$choice = $_POST['choice'];
$submit = $_POST['submit'];
$site_id = $_POST['site'];
echo $site_id;
foreach($choice as $val){
echo $val;
}
include "choose_form.php";
?>
The problem is that echo "$site_id"; returns 4, doesn't matter if I select the radio button beside site_id = 1
or site_id = 4.
I need it to return the value of the site_id in the row, I want to use this to update choose.value.