I have this table:
foreach( //conditionals ){
<td id="changeStatus">
<input type="text" name="rcStatus" value=""/>
</td>
}
The <td>
s are blank, and when I click on each one, the bgcolor of the cell changes, and also the value of rcStatus
.
I do using this code:
<script>
$('#table #changeStatus').click(
function(){
var cell = $(this);
state = cell.data('state') || 'first';
switch(state){
case 'first':
cell.addClass('red');
cell.data('state', 'second');
this.getElementsByTagName('input')[0].value = "missed";
break;
// other cases here
}
});
</script>
My problem now is that I need to store the value of rcStatus
in my database.
What happens is that I am only able to store the most recently set rcStatus
.
I'm using PHP.
foreach( //conditionals ){
mysql_query("INSERT INTO `details`(ID, Name, Status) VALUES('NULL','$_POST[name]','$_POST[rcStatus]');");
}
How can I call each individual variable using $_POST
even though I'm using the same name/id?