I have a page that reads the firstname (fname) from mysql database and gives each name a checkbox. See below:
PHP Code:
<html>
<body>
<?php
mysql_connect("localhost", "root", "dinosaur") or die(mysql_error());
mysql_select_db("info") or die(mysql_error());
$query = "SELECT fname FROM users";
$result = mysql_query($query) or die(mysql_error());
?>
<form name=myForm action='Edit.php' method='post'>
<?php
while($row = mysql_fetch_array($result)){
echo $row['fname']?> <input type="checkbox" name="<?php $row['fname']?>"><BR><?php
}
?>
<input type='submit' value='Confirm'></form>
</body>
</html>
Is the syntax correct where I am naming the checkbox? are the quotes correct? Also on the page where I am calling a value the syntax isnt correct becasue I get the error:
"Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in C:\Program Files\xampp\htdocs\Login\tests\Edit.php on line 1"
PHP Code:
<?php $thename=$_POST["$row['fname']"];
echo $thename;
?>
Thanks