Hello,
I'm a bit new to PHP and mysql.
Basically i'm trying to build something that will allow users to input information into several fields (mixture of text fields and check boxes), store the data in the database and then be able to view all current info in the database.
Then I need them to be able to edit the stored information by selecting one of the lines of stored information, and update the info.
I have managed to build the database with a table, and can add information into it, but how do I allow users to select the entry they have made, and then edit it?
Here's my code:
The index.php page
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Untitled Document</title>
</head>
<?php
//Make the connection
mysql_connect ("localhost", "noah77_noah", "appleface") or die ('I cannot connect to the database because: ' . mysql_error());
mysql_select_db ("noah77_cinternal");
//Build query
$query = mysql_query("SELECT * FROM `table1` ORDER BY `table1`.`FName` DESC LIMIT 0 , 30");
//Display results
while ($row = mysql_fetch_array($query)) {
"<br /> <b>ID:</b> " .$row['ID'].
"<br /> <b>First Name:</b> ".$row['FName'].
"<br /> <b>Last Name:</b> ".$row['LName'].
"<br /> <b>Phone:</b> ".$row['PHON'].
"<br />";
}
?>
<body>
</body>
</html>
The form.php page:
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Untitled Document</title>
</head>
<body>
<form method="post" action="update.php">
First Name: <br />
<input type="text" name="FName" size="30" /><br />
Last Name: <br />
<input type="text" name="LName" size="30" /><br />
Phone Number: <br />
<input type="text" name="PHON" size="12" /><br />
<input type="submit" value="Update Database" />
</body>
</html>
The updateinfo.php page:
Titel:<br/>
<input type="text" value="<?php echo $titel;?>" name="Titel" size=60/>
<br/>
Acteur:<br/>
<input type="text" value="<?php echo $acteur;?>" name="Acteur" size=60/>
<br/>
Taal:<br/>
<input type="text" value="<?php echo $taal;?>" name="Taal"/>
<br/>
Jaar:<br/>
<input type="text" value="<?php echo $jaar;?>" name="Jaar" size=10/>
<br/>
IMDB:<br/>
<input type="text" value="<?php echo $imdb;?>" name="IMDB" size=38/>
<br/>
Summary:<br/>
<TEXTAREA NAME="Summary" ROWS=6 COLS=45>
<?php echo $summary;?>
</TEXTAREA>
<br/>
Foto locatie:<br/>
<input type="text" value="<?php echo $foto;?>" name="Foto" size=59/>
</br>
<input type="submit" value="submit changes"/>
</form>
</body>
</html>
Also how do I format/style the information that is inputted into the database?
Thanks,
Noah