php form buton who response on Id from mysql table - help
Posted: Tue May 26, 2015 6:31 am
Hi, on first time I want to sorry for my bad english!
On second time I want ask little help from who of you who will want to help me, and I will very tankful for this.
I am new in php programing and mysql, for this sorry if the my way is not right!
Now on the problem!
I want to make something so "notes" webpage - something very little for now!
I make little base in MySQL in four cells. (id, name, RQtext, Complate)
I make a connection in one file.
And begin with index who combine other two files who i created (inserform.php and getrequest.php)
The problem is in getrequest.php (for now)! I make a table and in this table I extract the data from my table rq1 in this code:
In end of every row is generated submit button, but this button must be identified with only this row, that is the problem how to do this! When have click on submit button, the quest must completed, or in mysql in table rq1, the cell "Complete" must change value from 0 on 1 only for this row!
For look how must look
http://bg-media.net/learning/notes/
On second time I want ask little help from who of you who will want to help me, and I will very tankful for this.
I am new in php programing and mysql, for this sorry if the my way is not right!
Now on the problem!
I want to make something so "notes" webpage - something very little for now!
I make little base in MySQL in four cells. (id, name, RQtext, Complate)
I make a connection in one file.
And begin with index who combine other two files who i created (inserform.php and getrequest.php)
The problem is in getrequest.php (for now)! I make a table and in this table I extract the data from my table rq1 in this code:
Code: Select all
while($row = mysql_fetch_array($query)){
if($row['Complate'] == 0) {
$id = $row['id'];
$statusrq = "<td align=center> <input type=submit value=изпълни name=statusfalse id=$id> </td>";
echo "<form action=index.php method=POST>";
echo "<tr bgcolor=red>";
echo "<td>";
echo $id;
echo "</td><td>";
echo $row['name'];
echo "</td><td>";
echo $row['RQtext'];
echo "</td>";
echo $statusrq;
echo "</tr>";
echo "</form>";
if(isset($_POST['statusfalse'])) {
$sql = "UPDATE rq1 SET Complate=1 WHERE id=$id";
$result = mysql_query($sql);
}
} else {
$statusrq = "<td align=center bgcolor=lightblue> <b>завършена</b> </td>";
echo "<tr bgcolor=lightblue>";
echo "<td>";
echo $row['id'];
echo "</td><td>";
echo $row['name'];
echo "</td><td>";
echo $row['RQtext'];
echo "</td>";
echo $statusrq;
echo "</tr>";
}
}
echo "</table>";For look how must look
http://bg-media.net/learning/notes/