Using MySQL with ASP - Conclusion
(Page 4 of 4 )
That's it for this article. I've created an extra script for you to practice with. This script ask the user to leave a comment in the guest book. See if you can connect to the MYSQL database and add the information. Below is the HTML code:
<!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"><!-- InstanceBegin template="Templates/guestbook.dwt.php" codeOutsideHTMLIsLocked="false" -->
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<!-- InstanceBeginEditable name="doctitle" -->
<title>Untitled Document</title>
<!-- InstanceEndEditable -->
<!-- InstanceBeginEditable name="head" --><!-- InstanceEndEditable -->
<link href="user.css" rel="stylesheet" type="text/css" />
</head>
<body>
<table width="100%" border="1">
<tr>
<td colspan="2" class="welcomeheader">Welcome to David Webs Guest Book </td>
</tr>
<tr>
<td colspan="2"><!-- InstanceBeginEditable name="EditRegion3" --><form id="form1" name="form1" method="post" action="add.asp">
<table width="100%" border="1">
<tr>
<td colspan="2" class="header">Please add a comment: </td>
</tr>
<tr>
<td width="13%"> </td>
<td width="87%"> </td>
</tr>
<tr>
<td valign="top"><strong>Name:</strong></td>
<td><label>
<input name="name" type="text" id="name" />
</label></td>
</tr>
<tr>
<td valign="top"><strong>Comment:</strong></td>
<td><label>
<textarea name="comment" cols="40" rows="5" id="comment"></textarea>
</label></td>
</tr>
<tr>
<td> </td>
<td><label>
<input type="submit" name="Submit" value="Submit" />
</label></td>
</tr>
</table>
</form><!-- InstanceEndEditable --></td>
</tr>
<tr>
<td colspan="2" class="copy">©2008</td>
</tr>
</table>
</body>
<!-- InstanceEnd --></html>
And here's what the code produces:
The page basically presents the user with an HTML form that has two fields, one to take the user name and another that will take the comments that the user wants to leave. Once the user clicks on the submit button, the data will be sent to the ASP code. That is where you'd capture the form data and send it to the database. Happy coding!
| DISCLAIMER: The content provided in this article is not warranted or guaranteed by Developer Shed, Inc. The content provided is intended for entertainment and/or educational purposes in order to introduce to the reader key ideas, concepts, and/or product reviews. As such it is incumbent upon the reader to employ real-world tactics for security and implementation of best practices. We are not liable for any negative consequences that may result from implementing any information covered in our articles or tutorials. If this is a hardware review, it is not recommended to open and/or modify your hardware. |