I have 2 pages right now. One is list.php, the other one is detail.php.
The list.php is a table generated by mysql data. i add a column called "detail" at the end of each row. Everytime i click "detail", it redirects to detail.php and display a form according to the value of "sujet" (sujet is the first column of each row )in list.php.
This way i need to pass the value $row in list.php to detail.php.
How can i do it?
Any suggestions is appreciated! Thanks.
list.php
<?php
$conn = mysql_connect("localhost","root","") or die("Sorry, can't connect: ".mysql_error());
mysql_select_db($db);
$query = "SELECT sujet, bdate, nature, adetail, decideur FROM besoin ORDER BY bdate DESC";
$result = mysql_query($query, $conn) or die("Sorry, don't get result for error: ".mysql_error());
while($row = mysql_fetch_assoc($result)){
echo "<tr><td>".$row["sujet"]."</td>";
echo "<td>".$row["bdate"]."</td>";
echo "<td>".$row["nature"]."</td>";
echo "<td>".$row["adetail"]."</td>";
echo "<td>".$row["decideur"]."</td>";
echo "<td><a href=\"detail.php?row=$row['sujet']\" alt=\"detail\">DETAIL</a></td>";
echo "</tr><br>";
}
?>
detail.php:
<?php
$conn = mysql_connect("localhost","root","") or die("Sorry, can't connect: ".mysql_error());
mysql_select_db($db);
$row['sujet'] = asdf;
$query = "SELECT sujet, bdate, etat, qdate, qdetail, pdate, pdetail FROM besoin where sujet = row ";
$result = mysql_query($query, $conn) or die("Sorry, don't get result for error: ".mysql_error());
$row = mysql_fetch_assoc($result);
echo"<div id=\"form\">";
echo "<form>";
echo "<label>Sujet: </label><input type=\"text\" name=\"sujet\" value=\"".$row['sujet']."\"><br><br>";
echo "<label>Etat: </label><input type=\"text\" name=\"etat\" value=\"".$row["etat"]."\"/><br><br>";
echo "<label>Date: </label><input type=\"text\" name=\"bdate\" value=\"".$row["bdate"]."\"/><br><br>";
echo "<h2>Qualification</h2><br>";
echo "<label>Date:</label><input type=\"text\" name=\"qdate\" value=\"".$row["qdate"]."\"/><br><br>";
echo "<label>Detail:</label><br>";
echo "<textarea name=\"qdetail\" cols=\"40\" rows=\"5\">".$row["qdetail"]."</textarea><br><br>";
echo "<h2>Proposition</h2><br>";
echo "<label>Date:</label><input type=\"text\" name=\"pdate\" value=\"".$row["pdate"]."\" /><br><br>";
echo "<label>Detail:</label><br>";
echo "<textarea name=\"pdetail\" cols=\"40\" rows=\"5\">".$row["pdetail"]."</textarea><br><br>";
echo "</form><br>";
echo "</div>";
?>
with existing code, i get errors :
Parse error: parse error, expecting `T_STRING' or `T_VARIABLE' or `T_NUM_STRING' in list.php on line 41
I'm sorry for asking so many questions, but i really need to know how it works.
Thanks again!!