I have a problem with a PHP/SQL project I'm writing. It is basically a database of books, every book has its owner data. I set up a query to retrieve every book matching the query; what I want to do is being able to select one of the results, post its data to another PHP file (which will send a mail to the owner of the book). I wrote the code like this
$sql = "SELECT * FROM mydb WHERE parameter LIKE '%$value%' OR parameter LIKE '$value%' OR parameter LIKE '%$value'"; $result=mysql_query($sql);
$num = mysql_num_rows($result);
$i = 0; while ($i < $num) {
$attribute = mysql_result($result,$i,"attribute");
$mail = mysql_result($result,$i,"mail");
echo "
<form action=\"mailform.php\" method=\"post\"/><table border=\"1\">
<tr><
<td>$attribute</td>
<td>$mail</td>
<td><input type=\"submit\" value=\"Submit\"/></form></td>
</tr>
</table>
";
$i++;
}
The query is working, I get results. The mailform.php is set up this way
<?php
$mail = $_POST['$mail'];
?>
When I click on the submit button i am redirected to mailform.php but I get this error: Notice: Undefined index: $emailproprietario
What am I doing wrong? Thanks in advance