jason jollins Posted July 2, 2008 Share Posted July 2, 2008 Hi guys, I just created a new guestbook for my website and I'm running into what seems to be an easy fix that I just can't seem to figure out. Does anyone know how I can add a "Location" field into my guestbook or how to substitute the "email" field for "Location" ? My guestbook can be viewed at: http://jasonjollins.com/guestbook/guestbooksign.php Your help is much appreciated. Thanks, Jason Link to comment https://forums.phpfreaks.com/topic/112886-quick-question/ Share on other sites More sharing options...
MasterACE14 Posted July 2, 2008 Share Posted July 2, 2008 what exactly is the problem you have? Link to comment https://forums.phpfreaks.com/topic/112886-quick-question/#findComment-579833 Share on other sites More sharing options...
dmccabe Posted July 2, 2008 Share Posted July 2, 2008 Also showing us the code for the guestbook would help too Link to comment https://forums.phpfreaks.com/topic/112886-quick-question/#findComment-579837 Share on other sites More sharing options...
jason jollins Posted July 2, 2008 Author Share Posted July 2, 2008 what exactly is the problem you have? Thanks so much for the quick response. If you look on this page: http://jasonjollins.com/guestbook/guestbooksign.php you will see 3 fields for people to input info (Name, Email Address, Message). What I want to do is have a "Location" Field so that if someone signs the guestbook from a certain country they can input where they are from. Is there a way to do this? - Link to comment https://forums.phpfreaks.com/topic/112886-quick-question/#findComment-579841 Share on other sites More sharing options...
MasterACE14 Posted July 2, 2008 Share Posted July 2, 2008 put the code within code tags in this forum. Link to comment https://forums.phpfreaks.com/topic/112886-quick-question/#findComment-579865 Share on other sites More sharing options...
jason jollins Posted July 2, 2008 Author Share Posted July 2, 2008 put the code within code tags in this forum. i don't know how Link to comment https://forums.phpfreaks.com/topic/112886-quick-question/#findComment-579867 Share on other sites More sharing options...
jason jollins Posted July 2, 2008 Author Share Posted July 2, 2008 Can someone please help me with this? - Link to comment https://forums.phpfreaks.com/topic/112886-quick-question/#findComment-580146 Share on other sites More sharing options...
Jabop Posted July 2, 2008 Share Posted July 2, 2008 Yeah, you do this. Link to comment https://forums.phpfreaks.com/topic/112886-quick-question/#findComment-580152 Share on other sites More sharing options...
jason jollins Posted July 2, 2008 Author Share Posted July 2, 2008 Add entry <?php if (($_GET["add"]=="yes")){ $strGuestbook_Name= mysql_escape_string($_POST["txtName"]); $strGuestbook_Email= mysql_escape_string($_POST["txtEmail"]); $strGuestbook_Status= "Waiting"; $strGuestbook_Message= mysql_escape_string($_POST["txtMessage"]); include ("dbcon.php"); $query = "INSERT into guestbook (guestbook_Name, guestbook_Email, guestbook_Message, guestbook_Status) VALUES ('$strGuestbook_Name','$strGuestbook_Email','$strGuestbook_Message','$strGuestbook_Status')"; $record = mysql_query($query) or die (mysql_error()); if ($record) { header ("Location: postsuccess.php"); } mysql_close(); } function listPosts() { include ("dbcon.php"); $query = "SELECT * FROM guestbook WHERE guestbook_Status='Approved' ORDER BY guestbook_Id DESC"; $record = mysql_query($query) or die (mysql_error()); $strHTML = ""; $modCtr = 0; while ($row = mysql_fetch_array($record)) { $strGuestbook_Id = $row['guestbook_Id']; $strGuestbook_Name = $row['guestbook_Name']; $strGuestbook_Email = $row['guestbook_Email']; $strGuestbook_Status = $row['guestbook_Status']; $strGuestbook_Message= $row['guestbook_Message']; $strHTML = $strHTML."<tr><td align='left'><table width='100%' border='0' cellspacing='0' cellpadding='0'><tr>"; $strHTML = $strHTML."<td class='txtDivider'>· · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · ·</td>"; $strHTML = $strHTML."</tr><tr>"; $strHTML = $strHTML."<td class='txtMain'><strong>".$strGuestbook_Name."</strong></td>"; $strHTML = $strHTML."</tr><tr>"; $strHTML = $strHTML."<td><span class='txtMain'>".stripslashes($strGuestbook_Message)."</span></td>"; $strHTML = $strHTML."</tr></table></td></tr>"; } echo $strHTML; } ?> <HTML> <HEAD> <TITLE>Jason Jollins Guestbook</TITLE> <style type="text/css"> <!-- .style1 { font-family: Arial, Helvetica, sans-serif; font-size: 12; } .style4 {font-size: 10px} .style5 {font-family: Arial, Helvetica, sans-serif; font-size: 10px; } .style7 {font-size: 14px} --> </style> </HEAD> <BODY bgcolor=0E5A67 text=white alink=cfcffc link=FFFFFF vlink=cfcffc> <CENTER class="style1"> </CENTER> <table width="100%" border="0" cellspacing="2" cellpadding="0"> <tr> <td align="left" class="style1 style4"><CENTER> <H3>Guestbook</H3> </CENTER> <p class="style7">Thank you for signing my guest book! </td> </tr> <tr> <td align="left" class="style5"> </td> </tr> <tr> <td class="style5"><form action="guestbooksign.php?add=yes" method="post" name="frmContact" class="style4" onsubmit="javascript:return ValidateField();"> All fields are required. <table width="100%" border="0" cellspacing="0" cellpadding="5"> <tr class="txtMain"> <td width="100" align="left">Name</td> <td width="10">:</td> <td align="left"> <input name="txtName" type="text" id="txtName"></td> </tr> <tr class="txtMain"> <td width="100" align="left">E-mail Address </td> <td width="10">:</td> <td align="left"><input name="txtEmail" type="text" id="txtEmail"></td> </tr> <tr class="txtMain"> <td width="100" align="left" valign="top">Message</td> <td width="10" valign="top">:</td> <td align="left"> <textarea name="txtMessage" cols="25" rows="5" id="txtMessage"></textarea> </td> </tr> <tr class="txtMain"> <td width="100"> </td> <td width="10"> </td> <td align="left"> <input type="submit" name="Submit" value="Post" > <input type="reset" name="Submit2" value="Reset"> </td> </tr> </table> </form></td> </tr> <tr> <td class="style5"> </td> </tr> <tr> <td class="style5"><? listPosts(); ?></td> </tr> <tr> <td class="style1"> </td> </tr> </table> <p class="style1"> </BODY> </HTML> Display guestbook entries <?php if (($_GET["add"]=="yes")){ $strGuestbook_Name= mysql_escape_string($_POST["txtName"]); $strGuestbook_Email= mysql_escape_string($_POST["txtEmail"]); $strGuestbook_Status= "Waiting"; $strGuestbook_Message= mysql_escape_string($_POST["txtMessage"]); include ("dbcon.php"); $query = "INSERT into guestbook (guestbook_Name, guestbook_Email, guestbook_Message, guestbook_Status) VALUES ('$strGuestbook_Name','$strGuestbook_Email','$strGuestbook_Message','$strGuestbook_Status')"; $record = mysql_query($query) or die (mysql_error()); if ($record) { header ("Location: postsuccess.php"); } mysql_close(); } function listPosts() { include ("dbcon.php"); $query = "SELECT * FROM guestbook WHERE guestbook_Status='Approved' ORDER BY guestbook_Id DESC"; $record = mysql_query($query) or die (mysql_error()); $strHTML = ""; $modCtr = 0; while ($row = mysql_fetch_array($record)) { $strGuestbook_Id = $row['guestbook_Id']; $strGuestbook_Name = $row['guestbook_Name']; $strGuestbook_Email = $row['guestbook_Email']; $strGuestbook_Status = $row['guestbook_Status']; $strGuestbook_Message= $row['guestbook_Message']; $strHTML = $strHTML."<tr><td align='left'><table width='100%' border='0' cellspacing='0' cellpadding='0'><tr>"; $strHTML = $strHTML."<td class='txtDivider'>· · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · ·</td>"; $strHTML = $strHTML."</tr><tr>"; $strHTML = $strHTML."<td class='txtMain'><strong>".$strGuestbook_Name."</strong></td>"; $strHTML = $strHTML."</tr><tr>"; $strHTML = $strHTML."<td><span class='txtMain'>".stripslashes($strGuestbook_Message)."</span></td>"; $strHTML = $strHTML."</tr></table></td></tr>"; } echo $strHTML; } ?> <HTML> <HEAD> <TITLE>Jason Jollins Guestbook</TITLE> <style type="text/css"> <!-- .style1 { font-family: Arial, Helvetica, sans-serif; font-size: 12; } .style4 {font-size: 10px} .style5 {font-family: Arial, Helvetica, sans-serif; font-size: 10px; } .style7 {font-size: 14px} .style8 { font-size: 12px; font-weight: bold; } --> </style> </HEAD> <BODY bgcolor=0E5A67 text=white alink=cfcffc link=FFFFFF vlink=cfcffc> <CENTER class="style1"> </CENTER> <table width="100%" border="0" cellspacing="2" cellpadding="0"> <tr> <td align="left" class="style1 style4"><CENTER> <H3>Guestbook</H3> </CENTER> <p class="style7">Thank you for visiting JasonJollins.com! </td> </tr> <tr> <td align="left" class="style5"> </td> </tr> <tr> <td align="left" class="style5"><a href="guestbooksign.php" class="style1 style8">Click Here to Sign my Guest Book![/url]</td> </tr> <? listPosts(); ?> <tr> <td class="style5"> </td> </tr> <tr> <td class="style1"> </td> </tr> </table> <p class="style1"> </BODY> </HTML> Link to comment https://forums.phpfreaks.com/topic/112886-quick-question/#findComment-580155 Share on other sites More sharing options...
jason jollins Posted July 2, 2008 Author Share Posted July 2, 2008 Yeah, you do this. sweet thanks. do you know how i can put a location field into this as described above? - Link to comment https://forums.phpfreaks.com/topic/112886-quick-question/#findComment-580160 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.