Jump to content

Dada78

Members
  • Posts

    358
  • Joined

  • Last visited

    Never

Everything posted by Dada78

  1. Is this happening to anyone else?
  2. Does it have to be in php solution? Have you looked in RSS/XML feed? You are going to need to have the entire schedule layout out somewhere or you have to manually update the match ups from week to week anyways.
  3. Go to the page below and then click on the first display. Scroll down to the comments and you will see it says "No comments for this display, be the first to leave one". Then click submit and the comments will show. I have tested this on two different computers and two browsers and it did the same thing every time. Since you have to hit submit to display the comments, it then inserts a blank comment. http://www.mesquitechristmas.com/local/browse.php
  4. Well it contains a bunch of unrelavant code to the comments but here it is... <?php // connect to database include ('db_connect.php'); include ('utiles.php'); // start code for showing display information if (isset($_GET['id'])) { $id = mysql_real_escape_string($_GET['id']); $sql = "SELECT * FROM users WHERE id = $id;"; if ($result = mysql_query($sql)) { if (mysql_num_rows($result)) { $row = mysql_fetch_array($result); $id = $row["id"]; $displayname = $row["displayname"]; $owner = $row["owner"]; $displaytype = $row["displaytype"]; $address = $row["address"]; $city = $row["city"]; $state = $row["state"]; $postal = $row["postal"]; $country = $row["country"]; $StartDateMonth = $row['StartDateMonth']; $StartDateDay = $row['StartDateDay']; $EndDateMonth = $row['EndDateMonth']; $EndDateDay = $row['EndDateDay']; $StartTimeHour = $row['StartTimeHour']; $StartTimeMin = $row['StartTimeMin']; $EndTimeHour = $row['EndTimeHour']; $EndTimeMin = $row['EndTimeMin']; $meridiem = $row['meridiem']; $animated = $row['animated']; $TotalLights = $row['TotalLights']; $description = $row['description']; $website = $row['website']; $rating = $row['rating']; $votes = $row['votes']; $imgurl = $row['imgurl']; $imgurl2 = $row['imgurl2']; } else { die("No user found"); } } else { die(mysql_error()); } } // end code for showing display information // Start code for inserting comments if(isset($_POST['timeout'])) { if(time() < $_POST['timeout']) unset($_POST); $firstname = $_POST['firstname']; $location = $_POST['location']; $comment_date = date("m-d-Y"); $comment = $_POST['comment']; $id = $_POST['id']; // setup our query $query ="INSERT INTO comments (firstname, location, comment_date, comment, id) VALUES ('$firstname', '$location', '$comment_date', '$comment', '$id')"; $result=mysql_query($query) or die(mysql_error()); // run our query header("Location: {$_SERVER['REQUEST_URI']}"); exit(); // end code for inserting comments } // start code for displaying comments function show_data(){ $id = array(); $firstname = array(); $location = array(); $comment_date = array(); $comment = array(); $id = mysql_real_escape_string($_GET['id']); $i=0; if(isset($id)) { $limit = 5; { $sql = "SELECT * FROM comments WHERE id = '$id' ORDER BY comment_date DESC"; $site['url'] = "http://www.mesquitechristmas.com/local/display.php?id=$id"; $PageNav = swPagination( $sql, $MRPP = $limit, $UriAdd = $site['url'], $SortByAllow = FALSE, $SortOrderSeed = FALSE ); $result = $PageNav['RowList']; #Don't think I need the stuff above IF ( !$PageNav['TotalRes'] ) echo("<div class='commentsInner'>No Comments left for this Display. Be the first to leave one.</div>"); $i = 0; while ($row = mysql_fetch_array ($result)) { $color = ($i%2== 0 || $i == 0)?'#F4F4F4':'#E4E4E4'; $id[$i] = $row["id"]; $firstname[$i] = $row["firstname"]; $location[$i] = $row["location"]; $comment_date[$i] = $row["comment_date"]; $comment[$i] = $row["comment"]; print"<div class='commentsOutter'> <div class='commentsInner'> <div class='comments'>$comment[$i] <div class='commentsDetails'>Left By: $firstname[$i] | From: $location[$i] | Date: $comment_date[$i] </div> </div> </div> </div>"; ++$i; } } } print"<table width='100%'> <tr> <td> <div align='right'>$PageNav[HrefNav]</div></td> </tr> </table>"; } // end code for displaying comments ?> <!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" xml:lang="en" lang="en"> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8" /> <meta name="description" content="<? echo $row['city']; ?>,<? echo $row['state']; ?> <? echo $row['description']; ?>" /> <meta name="keywords" content="Mesquite, Texas, Country Christmas" /> <link rel="stylesheet" type="text/css" href="/stylesheet.css" media="screen" /> <script type="text/javascript" src="/drop_down.js"></script> <title>A Mesquite Country Christmas - <? echo $row['displayname']; ?></title> <script src="http://maps.google.com/maps?file=api&v=2&key=ABQIAAAAHsqGZjU15T9Ax9NeNmkr3BTBG4OpKDapRX640iwTNUvuS9ZsRhRAhx93j_0sEqAt5jDYsfdAlZ8gmw" type="text/javascript"></script> <script type="text/javascript"> //<![CDATA[ var map = null; var geocoder = null; var xmasIcon = new GIcon(); function load() { if (GBrowserIsCompatible()) { map = new GMap2(document.getElementById("Gmap")); map.addControl(new GLargeMapControl()); map.addControl(new GMapTypeControl()); map.addControl(new GScaleControl()); // Create our custom marker icon xmasIcon.image = "/images/markerdisplay.gif"; xmasIcon.iconSize = new GSize(13, 17); xmasIcon.iconAnchor = new GPoint (6, 20); xmasIcon.infoWindowAnchor = new GPoint (5, 1); geocoder = new GClientGeocoder(); } showAddress('<? echo $address; ?> <? echo $city; ?>,<? echo $state; ?> <? echo $postal; ?>'); } function showAddress(address) { if (geocoder) { geocoder.getLatLng( address, function(point) { if (!point) { map.setCenter(new GLatLng(32.7668, -96.5992), 11); map.openInfoWindowHtml(new GLatLng(32.7668, -96.5992),"<br>"+address+" is not found"); } else { map.setCenter(point, 14); var marker = new GMarker(point, xmasIcon); map.addOverlay(marker); GEvent.addListener(marker, "click", function() { marker.openInfoWindowHtml("<strong><? echo $displayname; ?></strong><br>"+ address +"<br /><a href='http://maps.google.com/maps?saddr=" + address + "' target='_blank'>Get Directions</a>"); }); } } ); } } //]]> </script> <style type="text/css"> p.c6 {text-align: center} textarea.c5 {width: 540px;} table.c4 {border-top: 1px solid #990000;} </style> </head> <body onload="load();populate()" onunload="GUnload()"> <div id="wrap"> <a href="/index.html"> <img id="frontphoto" src="/images/mcc_header1.gif" alt="Mesquite Country Christmas" border="0" /></a> <div id="menu"> <h2 class="hide">Menu:</h2> <ul id="avmenu"> <li><a href="/index.html">Home</a></li> <li><a href="/christmasstory.html">The Christmas Story</a></li> <li><a href="/directions.html">Directions</a></li> <li><a href="#">Information</a><ul> <li><a href="/information.html">Display Facts & Info</a></li> <li><a href="/faq.html">FAQ</a></li> <li><a href="/playlist.html">2008 Playlist</a></li> <li><a href="#">Christmas History</a></li> </ul></li> <li><a href="#">Photos</a> <ul> <li><a href="/2007photos.html">2007</a></li> </ul></li> <li><a href="#">Videos</a> <ul> <li><a href="/2007videos.html">2007</a></li> </ul></li> <li><a href="/guestbook.php">Guestbook</a></li> <li><a href="/webcam.html">Web Cam</a></li> <li><a href="/webradio.html">Internet Radio</a></li> <li><a href="http://www.noradsanta.org/" target="_blank">Track Santa</a></li> <li><a href="/projects.html">Projects & How Tos</a></li> <li><a href="/links.html">Links</a></li> <li><a href="/contact_us.html">Contact Us</a></li> </ul> <div class="c1"><a href="http://www.toysfortots.org/" target="_blank"><img src="/images/toys_for_tots.jpg" alt="toys for tots" border="0" width="110" height="153" vspace="10" /></a></div> <div class="c1"><a href="http://christmas.bronners.com/2007/house/534.html"><img src="http://christmas.bronners.com/voteforme/vote.jpg" border="0" width="110" height="153" alt="christmas decorations" vspace="10" /></a></div> </div> <div class="fadebox" id="content"> <h2><? echo $row['displayname']; ?></h2> <hr /> <table class="imgBox" width="100%" cellpadding="0" cellspacing="0"> <tr> <td align="center"> <table class="fullbox" align="center" width="100%" cellpadding="3" cellspacing="1"> <tr> <td align="center"><img src="/local/submitted/<? echo $row['imgurl1']; ?>" alt="<? echo $row['displayname']; ?>" class="border" width="520" height="320" id="big" /></td> </tr> <tr> <td align="center"><img src="/local/submitted/<? echo $row['imgurl1']; ?>" alt=" " height="60" width="60" onclick="getElementById('big').src=this.src" /> <img src="/local/submitted/<? echo $row['imgurl2']; ?>" alt=" " height="60" width="60" onclick="getElementById('big').src=this.src" /> <img src="/local/submitted/<? echo $row['imgurl3']; ?>" alt=" " height="60" width="60" onclick="getElementById('big').src=this.src" /> <img src="/local/submitted/<? echo $row['imgurl4']; ?>" alt=" " height="60" width="60" onclick="getElementById('big').src=this.src" /> <img src="/local/submitted/<? echo $row['imgurl5']; ?>" alt=" " height="60" width="60" onclick="getElementById('big').src=this.src" /> </td> </tr> </table> <table border="0" cellpadding="0" cellspacing="0" width="100%"><tr><td><img alt=" " border="0" height="7" src="/images/1pixel.gif" width="7" /></td><td class="shadow-mid" width="100%"><img alt=" " border="0" height="7" src="/images/1pixel.gif" width="7" /></td><td><img alt=" " border="0" height="7" src="/images/1pixel.gif" width="7" /></td></tr></table> </td> </tr> </table> <div class="b1"><a href='browse.php'><img src="images/return.gif" alt="return to list" /></a></div> <table border="0" cellpadding="0" cellspacing="0" class="fullbox" width="100%"> <tr> <td class="title">About This Display...</td> </tr> </table> <table border='0' cellpadding='2' cellspacing='0' class='fullbox' width='100%'> <tr><td class="bg1" width="115"><b>Display Name</b>:</td><td class="bg1"> <? echo $row['displayname']; ?></td></tr> <tr><td class="bg2" width="120"><b>Owner/Operated By</b>:</td><td class="bg2"> <? echo $row['owner']; ?></td></tr> <tr><td class="bg1"><b>Display Type</b>:</td><td class="bg1"> <? echo $row['displaytype']; ?></td></tr> <tr><td class="bg2" valign="top"><b>Address</b>:</td><td class="bg2"> <? echo $row['address']; ?><br /> <? echo $row['city']. "," . $row['state']. " " . $row['postal']; ?><br /> <? echo $row['country']; ?></td></tr> <tr><td class="bg1"><b>Dates</b>:</td><td class="bg1"> <? echo $row['StartDateMonth']; ?> <? echo $row['StartDateDay']; ?> <strong>to</strong> <? echo $row['EndDateMonth']; ?> <? echo $row['EndDateDay']; ?></td></tr> <tr><td class="bg2"><b>Times</b>:</td><td class="bg2"> <? echo $row['StartTimeHour']; ?>:<? echo $row['StartTimeMin']; ?> <? echo $row['meridiem']; ?> <strong>to</strong> <? echo $row['EndTimeHour']; ?>:<? echo $row['EndTimeMin']; ?> <? echo $row['meridiem']; ?></td></tr> <tr><td class="bg1"><b>Animated</b>:</td><td class="bg1"> <? echo $row['animated']; ?></td></tr> <tr><td class="bg2"><b>Total Lights</b>:</td><td class="bg2"> <? echo $row['TotalLights']; ?></td></tr> <tr><td class="bg1"><b>Description</b>:</td><td class="bg1"> <? echo $row['description']; ?></td></tr> <tr><td class="bg2"><b>Website</b>:</td><td class="bg2"> <a href="<? echo $row['website']; ?>"><? echo $row['website']; ?></a></td></tr> <tr><td class="bg1" valign="top"><b>Current Conditions</b>:</td><td class="bg1"> <?php include("http://www.mesquitechristmas.com/hw/hw3.php?config=&forecast=zandh&pands=$postal&alt=display_current"); ?></td></tr> <tr><td class="bg2" valign="top"><b>Sponsor Links</b>:</td><td class="bg2"> <script type="text/javascript"><!-- google_ad_client = "pub-8048181801684156"; /* 234x60, created 2/2/08 */ google_ad_slot = "1119945783"; google_ad_width = 234; google_ad_height = 60; //--> </script> <script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"> </script> </td> </tr> </table> <table border="0" cellpadding="0" cellspacing="0" width="100%"><tr><td><img alt=" " border="0" height="7" src="/images/1pixel.gif" width="7" /></td><td class="shadow-mid" width="100%"><img alt=" " border="0" height="7" src="/images/1pixel.gif" width="7" /></td><td><img alt=" " border="0" height="7" src="/images/1pixel.gif" width="7" /></td></tr></table> <br /> <table border='0' cellpadding='0' cellspacing='0' class='fullbox' width='100%'> <tr> <td class="title">Directions to <? echo $row['displayname']; ?>...</td> </tr> </table> <table class="fullboxGmap" width="100%" cellpadding="3" cellspacing="1"> <tr> <td><div id="Gmap"></div></td> </tr> </table> <table border="0" cellpadding="0" cellspacing="0" width="100%"><tr><td><img alt=" " border="0" height="7" src="/images/1pixel.gif" width="7" /></td><td class="shadow-mid" width="100%"><img alt=" " border="0" height="7" src="/images/1pixel.gif" width="7" /></td><td><img alt=" " border="0" height="7" src="/images/1pixel.gif" width="7" /></td></tr></table> <div class="b2"><?php include("http://www.mesquitechristmas.com/hw/hw3.php?config=&forecast=zandh&pands=$postal&alt=extended_forecast"); ?></div> <div class="b1"><?php include("http://www.mesquitechristmas.com/hw/hw3.php?config=&forecast=zandh&pands=$postal&alt=display_warnings"); ?></div> <div class="title">Comments For <? echo $row['displayname']; ?>...</div> <div class="fullbox"> <?php show_data(); ?> </div> <table border="0" cellpadding="0" cellspacing="0" width="100%"> <tr> <td><img alt=" " border="0" height="7" src="/images/1pixel.gif" width="7" /></td> <td class="shadow-mid" width="100%"><img alt=" " border="0" height="7" src="/images/1pixel.gif" width="7" /></td> <td><img alt=" " border="0" height="7" src="/images/1pixel.gif" width="7" /></td> </tr> </table> <a name="comments" id="comments"></a> <form method="post" action="display.php?id=<?php echo $row['id']."#comments"; ?>"> <input type="hidden" name="id" value="<?php echo $id; ?>" /> <div class="boxWrapper"> <div class="commentsInner commentsInput"> <table border="0" cellpadding="4" cellspacing="0" width="100%"> <tr> <td width="203">Name: <input type="text" name="firstname" value="Anonymous" onclick="this.value=''" /></td> <td width="287">Location: <input type="text" name="location" value="Anonymous" onclick="this.value=''" /></td> </tr> <tr> <td colspan="2"><br /> Comment (Max 255 characters):<br /> <textarea name="comment" rows="5" cols="50" class="c5" onkeydown="javascript:limittext(this.form.comment);"> </textarea></td> </tr> <tr> <td colspan="2" align="right"><input type="reset" value="Reset" /> <input type="submit" value="Submit" name="timeout" /></td> </tr> </table> </div> </div> <table border="0" cellpadding="0" cellspacing="0" width="100%"> <tr> <td><img alt=" " border="0" height="7" src="/images/1pixel.gif" width="7" /></td> <td class="shadow-mid" width="100%"><img alt=" " border="0" height="7" src="/images/1pixel.gif" width="7" /></td> <td><img alt=" " border="0" height="7" src="/images/1pixel.gif" width="7" /></td> </tr> </table> </form> <div class="b1"><a href='browse.php'><img src="images/return.gif" alt="return to list" /></a></div> </div> </div> <div id="footer">© 2007-2008 Mesquite Country Christmas<br /> This site best viewed with <a href="http://www.spreadfirefox.com/node&id=0&t=219"><img border="0" alt="Firefox 3" title="Firefox 3" src="http://sfx-images.mozilla.org/affiliates/Buttons/firefox2/ff2b80x15.gif" /></a> <p align="center"> <a href="http://validator.w3.org/check?uri=referer"><img src="http://www.w3.org/Icons/valid-xhtml10" alt="Valid XHTML 1.0 Transitional" height="31" width="88" /></a> <a href="http://jigsaw.w3.org/css-validator/validator?uri=http%3A%2F%2Fwww.mesquitechristmas.com%2Fstylesheet.css&profile=css21&usermedium=all&warning=1/"><img class="c1" src="http://jigsaw.w3.org/css-validator/images/vcss" alt="Valid CSS!" /></a> </p> <script type="text/javascript"><!-- google_ad_client = "pub-8048181801684156"; //468x60, created 1/8/08 google_ad_slot = "0360766123"; google_ad_width = 468; google_ad_height = 60; //--></script> <script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"> </script> </div> </body> </html>
  5. This is the code for displaying the comments. // start code for displaying comments function show_data(){ $id = array(); $firstname = array(); $location = array(); $comment_date = array(); $comment = array(); $id = mysql_real_escape_string($_GET['id']); $i=0; if(isset($id)) { $limit = 5; { $sql = "SELECT * FROM comments WHERE id = '$id' ORDER BY comment_date DESC"; $site['url'] = "http://www.mesquitechristmas.com/local/display.php?id=$id"; $PageNav = swPagination( $sql, $MRPP = $limit, $UriAdd = $site['url'], $SortByAllow = FALSE, $SortOrderSeed = FALSE ); $result = $PageNav['RowList']; #Don't think I need the stuff above IF ( !$PageNav['TotalRes'] ) echo("<div class='commentsInner'>No Comments left for this Display. Be the first to leave one.</div>"); $i = 0; while ($row = mysql_fetch_array ($result)) { $color = ($i%2== 0 || $i == 0)?'#F4F4F4':'#E4E4E4'; $id[$i] = $row["id"]; $firstname[$i] = $row["firstname"]; $location[$i] = $row["location"]; $comment_date[$i] = $row["comment_date"]; $comment[$i] = $row["comment"]; print"<div class='commentsOutter'> <div class='commentsInner'> <div class='comments'>$comment[$i] <div class='commentsDetails'>Left By: $firstname[$i] | From: $location[$i] | Date: $comment_date[$i] </div> </div> </div> </div>"; ++$i; } } } print"<table width='100%'> <tr> <td> <div align='right'>$PageNav[HrefNav]</div></td> </tr> </table>"; } // end code for displaying comments
  6. Ok, so what would be causing the comments to not show unless you hit the submit button when you first visit the page?
  7. For reference what is the purpose of exit();? That seems to resolve the refresh problem. Only problem I am still having is the comments do no show when you first visit the page. You have to hit submit in order to get the comments to show which then inserts an empty entry. Any idea why this could be happening? -Thanks
  8. Just curious, I have noticed the two codes that were posted were about the same except one has if(isset and one doesn't have the isset. What is the difference?
  9. I understand that part but this... session_start(); Has to be at the very top of the page before any HTML is outtputed correct?
  10. Ok this is what I have done as suggested, is this correct? It seems to have cured the one problem with the refresh but want to make sure. // setup our query $query ="INSERT INTO comments (firstname, location, comment_date, comment, id) VALUES ('$firstname', '$location', '$comment_date', '$comment', '$id')"; $result=mysql_query($query) or die(mysql_error()); // run our query header("Location: {$_SERVER['REQUEST_URI']}"); // end code for inserting comments }
  11. No it can not be where ever I want it. Session Start has to be and the top of the page before and HTML is outputted. You are right, I don't know how sessions work which is why I am here asking for help. I don't deal with php, I strictly deal with XHTML and CSS. This is was a project started by me and a friend as he knew php. So he was going to do the php and I was going to do the layout and design, which I have done. Only thing is he couldn't finish it because he was killed in a car wreck. So it has left me to try to figure it out and finish. So can anyone help?
  12. That doesn't work, nothing shows. Also that means the link as to be at the very top of the page and I don't want it there. Any other ideas?
  13. I am using sessions but if I include that to the top of the pages outside of the control panel. Wouldn't that make it where they had to be logged in to view it? If that is the case that is not what I want.
  14. Hello, I have a website where one section requires a login to get to the user control panel. I would like to add a link on other pages outside of the control panel so that if the user navigates away from the control panel they can click a link to return back to the control panel if they are logged in. How could I go about doing something like this? -Thanks
  15. No I haven't added anything, but I will repost the code for the comments just so we are on the same page. PHP... // Start code for inserting comments if(isset($_POST['timeout'])) { if(time() < $_POST['timeout']) unset($_POST); $firstname = $_POST['firstname']; $location = $_POST['location']; $comment_date = date("m-d-Y"); $comment = $_POST['comment']; $id = $_POST['id']; // setup our query $query ="INSERT INTO comments (firstname, location, comment_date, comment, id) VALUES ('$firstname', '$location', '$comment_date', '$comment', '$id')"; $result=mysql_query($query) or die(mysql_error()); // run our query // end code for inserting comments } // start code for displaying comments function show_data(){ $id = array(); $firstname = array(); $location = array(); $comment_date = array(); $comment = array(); $id = mysql_real_escape_string($_GET['id']); $i=0; if(isset($id)) { $limit = 5; { $sql = "SELECT * FROM comments WHERE id = '$id' ORDER BY comment_date DESC"; $site['url'] = "http://www.mesquitechristmas.com/local/display.php?id=$id"; $PageNav = swPagination( $sql, $MRPP = $limit, $UriAdd = $site['url'], $SortByAllow = FALSE, $SortOrderSeed = FALSE ); $result = $PageNav['RowList']; #Don't think I need the stuff above IF ( !$PageNav['TotalRes'] ) echo("<div class='commentsInner'>No Comments left for this Display. Be the first to leave one.</div>"); $i = 0; while ($row = mysql_fetch_array ($result)) { $color = ($i%2== 0 || $i == 0)?'#F4F4F4':'#E4E4E4'; $id[$i] = $row["id"]; $firstname[$i] = $row["firstname"]; $location[$i] = $row["location"]; $comment_date[$i] = $row["comment_date"]; $comment[$i] = $row["comment"]; print"<div class='commentsOutter'> <div class='commentsInner'> <div class='comments'>$comment[$i] <div class='commentsDetails'>Left By: $firstname[$i] | From: $location[$i] | Date: $comment_date[$i] </div> </div> </div> </div>"; ++$i; } } } print"<table width='100%'> <tr> <td> <div align='right'>$PageNav[HrefNav]</div></td> </tr> </table>"; } // end code for displaying comments HTML <div class="title">Comments For <? echo $row['displayname']; ?>...</div> <div class="fullbox"> <?php show_data(); ?> </div> <table border="0" cellpadding="0" cellspacing="0" width="100%"> <tr> <td><img alt=" " border="0" height="7" src="/images/1pixel.gif" width="7" /></td> <td class="shadow-mid" width="100%"><img alt=" " border="0" height="7" src="/images/1pixel.gif" width="7" /></td> <td><img alt=" " border="0" height="7" src="/images/1pixel.gif" width="7" /></td> </tr> </table> <a name="comments" id="comments"></a> <form method="post" action="display.php?id=<?php echo $row['id']."#comments"; ?>"> <input type="hidden" name="id" value="<?php echo $id; ?>" /> <div class="boxWrapper"> <div class="commentsInner commentsInput"> <table border="0" cellpadding="4" cellspacing="0" width="100%"> <tr> <td width="203">Name: <input type="text" name="firstname" value="Anonymous" onclick="this.value=''" /></td> <td width="287">Location: <input type="text" name="location" value="Anonymous" onclick="this.value=''" /></td> </tr> <tr> <td colspan="2"><br /> Comment (Max 255 characters):<br /> <textarea name="comment" rows="5" cols="50" class="c5" onkeydown="javascript:limittext(this.form.comment);"> </textarea></td> </tr> <tr> <td colspan="2" align="right"><input type="reset" value="Reset" /> <input type="submit" value="Submit" name="timeout" /></td> </tr> </table> </form> </div> </div> -Thanks
  16. The full code is above in my first post. They are both on the same page. The php is at the top and of course the form is placed in the HTML where it needs to be towards the bottom. That is all the code that is for the comments script. I can pull the full code for the page, but it will probably be irrelevant since it has a lot of unneeded code posted.
  17. It does, but that wouldn't have any bearing over the problems I am having.
  18. Yes, but what? That is what I am trying to resolve. Some people say it happens, some don't. I don't know why this is happening. All the code is on the same page it it does redirect back to it after the form as been submitted. At least I think it does? All the code is on the same page so it doesn't redirect anywhere.
  19. Please anyone? I really need some help with this bad. I am running out of time.
  20. Well the comments are inserting and showing now but I have two or three problems. I am not sure what adding timeout to the submit button was suppose to do though. 1.) I am not sure if this happens with everyone but it happens with me on FF3 and IE7. If the page has comments and you first visit the page. The previous comments that are already there do not show unless you hit submit. So no one can view the comments unless the hit submit. 2.) For some reason it is also inserting a blank comment when you insert a comment or refresh the page. So basically it inserts two comments. The one from the visitor and then an empty one. 3.) If a visitor refreshes the page it will flood the comments and allow them to insert the same comment over and over again by refreshing. If I can get these sorted out it will run perfectly. Can anyone help me with this? -Thanks
  21. Just so I follow you are you suggesting doing this? <input type="submit" value="Submit" name="timeout" /> -Thanks
  22. Hello all, I am having a minor problem with this comments script I have. When I first wrote this up it was back in Feb and I haven't worked on it until now because I need to finish it for obvious reasons when you see it. Anyways, I can not remember what was wrong with it when I took a break from it. To my knowledge it was working fine. I have been validating all the code on the pages so I can launch this section to the rest of the site. When I validated it now it stopped working. When you type something in the text area and hit submit it doesn't submit the info. It just refreshes the a page and sends you back down to the form. The comment box is at the bottom of this page. http://www.mesquitechristmas.com/loc...play.php?id=61 What is really strange is this page has comments but when you first visit it they don't show unless you hit submit then they show. They use to show regardless. So it is connecting to the DB just not sure why it is not submitting.... So if they are not showing when you visit this page that is why, just hit the submit button. http://www.mesquitechristmas.com/local/display.php?id=2 Here is the php for the comment field // Start code for inserting comments if(isset($_POST['timeout'])) { if(time() < $_POST['timeout']) unset($_POST); $firstname = $_POST['firstname']; $location = $_POST['location']; $comment_date = date("m-d-Y"); $comment = $_POST['comment']; $id = $_POST['id']; // setup our query $query ="INSERT INTO comments (firstname, location, comment_date, comment, id) VALUES ('$firstname', '$location', '$comment_date', '$comment', '$id')"; $result=mysql_query($query) or die(mysql_error()); // run our query // end code for inserting comments } // start code for displaying comments function show_data(){ $id = array(); $firstname = array(); $location = array(); $comment_date = array(); $comment = array(); $id = mysql_real_escape_string($_GET['id']); $i=0; if(isset($id)) { $limit = 5; { $sql = "SELECT * FROM comments WHERE id = '$id' ORDER BY comment_date DESC"; $site['url'] = "http://www.mesquitechristmas.com/local/display.php?id=$id"; $PageNav = swPagination( $sql, $MRPP = $limit, $UriAdd = $site['url'], $SortByAllow = FALSE, $SortOrderSeed = FALSE ); $result = $PageNav['RowList']; #Don't think I need the stuff above IF ( !$PageNav['TotalRes'] ) echo("<table class='fullbox' align='center' width='100%' cellpadding='1' cellspacing='1'><tr bgcolor='".$color."'> <td align='left'>No Comments left for this Display. Be the first to leave one.</td></tr></table>"); $i = 0; while ($row = mysql_fetch_array ($result)) { $color = ($i%2== 0 || $i == 0)?'#F4F4F4':'#E4E4E4'; $id[$i] = $row["id"]; $firstname[$i] = $row["firstname"]; $location[$i] = $row["location"]; $comment_date[$i] = $row["comment_date"]; $comment[$i] = $row["comment"]; print"<table class='fullbox' align='center' width='100%' cellpadding='1' cellspacing='1'><tr bgcolor='".$color."'> <td align='left' width='120'><strong> Name</strong>: $firstname[$i]</td> <td align='left' width='120'><strong> Location</strong>: $location[$i]</td> <td align='left' width='216'><strong> Date</strong>: $comment_date[$i]</td> </tr> <tr bgcolor='".$color."'> <td colspan='4'><strong> Comment</strong>: $comment[$i]</td> </tr></table>"; ++$i; } } } print"<table width='100%'> <tr> <td> <div align='right'>$PageNav[HrefNav]</div></td> </tr> </table>"; } // end code for displaying comments Here is the HTML for the form and where it is displayed. <div class="title">Comments For <? echo $row['displayname']; ?>...</div> <div class="fullbox"> <?php show_data(); ?> </div> <a name="comments" id="comments"> <form method="post" action="display.php?id=<?php echo $row['id']."#comments"; ?>"> <input type="hidden" name="id" value="<?php echo $id; ?>" /> <div class="boxWrapper"> <div class="commentsInner"> <div class="commentsInput"><table border="0" cellpadding="4" cellspacing="0" width="100%"> <tr> <td width="203">Name: <input type="text" name="firstname" value="Anonymous" onclick="this.value=''" /></td> <td width="287">Location: <input type="text" name="location" value="Anonymous" onclick="this.value=''" /></td> </tr> <tr> <td colspan="2"><br /> Comment (Max 255 characters):<br /> <textarea name="comment" rows="5" cols="50" class="c5" onkeydown="javascript:limittext(this.form.comment);"> </textarea></td> </tr> <tr> <td colspan="2" align="right"><input type="reset" value="Reset" /> <input type="submit" value="Submit" /></td> </tr> </table </div> </div> </div> <table border="0" cellpadding="0" cellspacing="0" width="100%"> <tr> <td><img alt=" " border="0" height="7" src="/images/1pixel.gif" width="7" /></td> <td class="shadow-mid" width="100%"><img alt=" " border="0" height="7" src="/images/1pixel.gif" width="7" /></td> <td><img alt=" " border="0" height="7" src="/images/1pixel.gif" width="7" /></td> </tr> </table> </form> </a> Any suggestion or ideas would be great as I am stumped. I think it has something to do with how the form is submitting but not sure as to what.... I am not all that educated when it comes to forms as I don't use them often. -Thanks
  23. No that is not what I was looking for... I got it all sorted now. I was looking for this to add to the Query.. $email = $_SESSION['email'];
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.