I've been building a CMS system and have virtually completed it - when the client wants to edit something from the database, say a case study, they select edit and are met with a standard html form to fill in and update the details. I'm pulling in the existing details for the case study into the form choices as follows:
Code: Select all
<?php
//connect to database
mysql_pconnect ($host, $user, $pass) or die ("Login info is incorrect") ;
mysql_select_db ($database);
//selects everything from the table and puts it in to $result variable
$result = mysql_query("SELECT * FROM $tableTen WHERE id=" . $_GET['id']);
$data = mysql_fetch_array($result);
<form input section......
<input type="text" tabindex="1" name="casestudy_name" value="<?php echo $data['name'] ?>" style="width:245px" />
<textarea name="casestudy_information" tabindex="3" rows="12" cols="50" style="width:450px"><?php echo $data['information'] ?></textarea>
etc etc
?>
Code: Select all
<select name="client_id">
<option value="0">Choose section...</option>
<option value="1">section 1</option>
<option value="2">section 2</option>
<option value="3">section 3</option>
<option value="4">section 4</option>
<option value="5">section 5</option>
<option value="6">section 6</option>
</select>
Cheers