Populating a HTML textbox value with PHP -
ok iv been learning php past 2 days please bare me, im trying populate html textbox value $firstname
but keep getting http 500 internal server error insert php part works fine,
this php code box im trying set down bottom
<?php $firstname = $_post['fname']; $surname = $_post['lname']; $username = $_post['uname']; $password = $_post['password']; $valid = mysql_connect('localhost' , 'root' , 'pword'); if(!$valid) { echo 'could not connect' . mysql_error(); } else { mysql_select_db('accounts', $valid) or die('could not select database'); $query = "insert `users` (`username`, `password`, `firstname`, `surname`) values ('".$username."' , '".$password."' , '".$firstname."' , '".$surname."')"; mysql_query($query, $valid) or die('error adding users details.'); echo "the following user " . $firstname . " has been added database"; } <html> <body> <input type="text" name="uname" size="30" value=<?php echo htmlentities($firstname); ?>/><br/> </body> </html> ?> im not sure im doing wrong if can point me in right direction or show me solution appreciate it, again iv been learning php past 2 days.
remove ?> end , put before <html>
Comments
Post a Comment