I have a form that works fine:
Here is the form:
<HTML>
<HEAD>
<TITLE>Insert Form</TITLE>
</HEAD>
<BODY>
<?php
// Set the page title and include the HTML header.
$page_title = 'Wireless Neighborhoods';
include_once ('include/header.html');
?>
<FORM ACTION="insert_basicinfo.php" METHOD=POST>
<title>Basic Information</title>
<fieldset>
<legend>Enter your information in the form below:</legend>
<table width="990" height="206" border="1">
<tr>
<th width="467" scope="col" bgcolor="#CCFFFF"><b>Student ID:</b>
<input type="text" name="student_id" size="15" maxlength="15" </th>
<th width="507" scope="col" bgcolor="#CCFFFF">
Input Date: <input type="text" name="insert_date" size="15" maxlength="15" </th><br>
<?php
//Prints something like: Monday 15th of January 2003 05:51:38 AM
echo date("l dS of F Y -- h:i:s A");//Prints something like: Monday the 15th
?>
</tr>
<tr>
<td><p><i><strong>Enter Name: First, Last</strong></i><br>
<input type="text" name="fname" size="15" maxlength="15">
<input type="text" name="lname" size="30" maxlength="30">
<br><b>Address:</b> <br>
<input type="text" name="address" size="40" maxlength="40">
</p>
<p><b>City, State, Zip Code</b> <br>
<input type="text" name="city" size="15" maxlength="15">,
<input type="text" name="state" size="4" maxlength="4">
<input type="text" name="zip" size="10" maxlength="20">
<br>
</p></td>
<td><b>CTC Organization:</b><br>
<select size="1" name="ctcorg">
<option selected>Select One</option>
<option>Bloomfield Garfield Corp.</option>
<option>East End Cooperative Ministry</option>
<option>Mt. Ararat Community Activity Center</option>
<option>Parental Stress Center</option>
<option>YouthPlaces</option>
</select> <br><br>
<b>Case Manager :</b> <br>
<input type="text" name="cmanager" size="40" maxlength="40">
<p><b>Neighborhood:<br>
<select size="1" name="neighborhood">
<option selected>Select One</option>
<option>Bloomfield</option>
<option>Garfield</option>
<option>East Liberty</option>
<option>Lincoln/Larmar</option>
<option>Shadyside</option>
<option>South Point Breeze</option>
<option>North Point Breeze</option>
</select></b></p>
<p> </td>
</tr>
<tr>
<td valign="top"><p><b>Home Phone:</b> <br>
<input type="text" name="hphone" size="40" maxlength="40">
</p>
<p><b>Mobil Phone:</b> <br>
<input type="text" name="mphone" size="40" maxlength="40">
</p>
<p><b>Email Address:</b></p>
</p>
<input type="text" name="email" size="40" maxlength="40">
</p>
</td>
<td>
<p><b>Notes:<br>
</b><textarea rows="5" name="notes" cols="48"></textarea><br>
</td>
</tr>
</table>
</fieldset>
<p><input type=submit name="submit" value="Insert Record"></p>
</p>
</div>
</form>
<!-- End of Form -->
<?php
include_once ('include/footer.html');
?>
As I said this form works fine for putting data into the database.
Now I would like to use it to view the results of the database.
How do I go about shifting the job of the form to show data rather that post data.
Here is the .php script I am using to post the data.
<?php
// open the connection
//connect to server and select database
$conn = mysql_connect("db.wireless-neighborhoods.org", "scfn", "scfn75") or die(mysql_error());
mysql_select_db("scfn",$conn) or die(mysql_error());
$sql = "INSERT INTO client values ('', '$POST[student_id]', NOW(), '$POST[fname]', '$POST[lname]', '$POST[address]', '$POST[city]', '$POST[state]', '$POST[zip]', '$POST[hphone]', '$POST[mphone]', '$POST[email]', '$POST[ctcorg]', '$POST[cmanager]', '$POST[neighborhood]', '$POST[notes]', NOW() )";
// execute the SQL statement
if (mysql_query($sql, $conn)) {
echo "<P>Your entry has been added.<br> Would you like to
<a href=\"basicinfo_form.php\">add another</a>or return <a href=\"indexdata.php\">Home</a>?</p>";
} else {
echo "something went wrong";
}
?>
Can anyone help.