I want to edit information that is stored in a database. I would like to have the current stored info viewable in the text fields so the administrator can see what has already been entered. I am having trouble selecting the primary key (the row). Please help.
Also it would be very much appreciated if you could add the correct code (if necessary) when you are explaining because i am very new at php and not familiar with many terms or rules of the language.
Thankyou, it is very appreciated!
<?php
$user = "username";
$pass = "password";
$db = "database";
$link = mysql_connect( "localhost", $user, $pass );
if ( ! $link )
die( "Couldn't connect to MySQL" );
mysql_select_db( $db )
or die ( "Couldn't open $db: ".mysql_error() );
$query = "UPDATE rhd_traffic SET name = '$name', url = '$url', email = '$email' where primary = $name ";
mysql_query( $query, $link)
or die ( "Couldn't add data to \"rhd_traffic\" tables: "
.mysql_error() );
mysql_close( $link );
?>
<body>
<blockquote>
<form name="form" action="beta_test.php" method="post">
Program Name:
<input type="text" name="name" value="<?php echo $name ?>\" size="20">
<br>
Home URL:
<input type="text" name="url" value="<?php echo $url ?>" size="20">
<br>
Email Address:
<input type="text" name="email" value="<?php echo $email ?>" size="20">
<br>
<input type="submit"><input type="reset">
</blockquote>
</body>