djp1988 Posted June 5, 2008 Share Posted June 5, 2008 On a page of mine people can vote and leave a message, the vote is inserted into the database according tot he get variable, and the message is sent via the post variable, but if i vote and then leave a message, so the page loads with a get variable whilst transmitting a post variable then i get a server error message, why? The message is already been inserted and if you leave this page and come back the message is there but I don't like having this error message, it looks bad Link to comment Share on other sites More sharing options...
Synook Posted June 6, 2008 Share Posted June 6, 2008 What does your code look like?You can always redirect with header("location: Link to comment Share on other sites More sharing options...
djp1988 Posted June 8, 2008 Author Share Posted June 8, 2008 Here it has happened again, I don't know why...this is the error message:Internal Server ErrorThe server encountered an internal error or misconfiguration and was unable to complete your request.Please contact the server administrator, support@supportwebsite.com and inform them of the time the error occurred, and anything you might have done that may have caused the error.More information about this error may be available in the server error log.Apache/1.3.33 Server at www.euroherp.com Port 80 Link to comment Share on other sites More sharing options...
boen_robot Posted June 8, 2008 Share Posted June 8, 2008 Again, what does your PHP code look like? A link to the form would be nice too. Link to comment Share on other sites More sharing options...
djp1988 Posted June 11, 2008 Author Share Posted June 11, 2008 <?php require_once ('../mysql_connect.php');$thispage = "http://" . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];$idofthistrip = "999";$userid = $_SESSION['user_id'];$query6 = "SELECT COUNT(member_id) AS didivoteFROM note_tripsWHERE trip_id = $idofthistrip AND member_id=$userid";$result6 = mysql_query ($query6, $dbc);$row6 = mysql_fetch_array ($result6, MYSQL_BOTH); $haveivoted = "{$row6['didivote']}";echo'<div id="Menu"> ';if(isset($_POST['Submit'])){ $commentsent = $_POST['commentinput']; $q = "SELECT email, first_name, last_name, htmlfile, h_first_name, h_last_name, emailofherp FROM users, comment_trips, trips, herpers WHERE users.user_id = comment_trips.id_of_member AND trips.id_trip = comment_trips.id_of_trip AND herpers.id_herper = trips.herper_id AND id_of_trip = $idofthistrip ORDER BY comment_id DESC LIMIT 0,1"; $r = @mysql_query ($q); $rowofemail = mysql_fetch_array ($r, MYSQL_BOTH); $emailoflastcomment = "{$rowofemail['email']}"; $emailofauthor = "{$rowofemail['emailofherp']}"; $authorname = "{$rowofemail['h_first_name']} {$rowofemail['h_last_name']}"; $linktothispage = "{$rowofemail['htmlfile']}"; $useremail = $_SESSION['email']; if($useremail != $emailoflastcomment){ $body = "Someone has replied to your comment on the European Field Herping Community, on this page: " . $linktothispage . " \n \nThe European Field Herping Community automatic comment replying system"; mail($emailoflastcomment, 'Someone replied to your comment', $body, 'From: admin@euroherp.com');} $body2 = "Hello " .$authorname. ", \nA comment on your field trip report on the European Field Herping Community was added: " . $linktothispage . " \n \nThe European Field Herping Community automatic comment replying system"; mail($emailofauthor, 'Someone added a comment to your report', $body2, 'From: admin@euroherp.com'); $query8 = "INSERT INTO comment_trips(comment_id,id_of_trip, id_of_member,comment,date) VALUES('',$idofthistrip,$userid,\"$commentsent\",NOW())"; $result8 = @mysql_query ($query8);} if(isset($_GET['n'])){$notejustgiven = (int) $_GET['n'];if(!$haveivoted){if ($notejustgiven <6) { $query5 = "INSERT INTO note_trips(note_id,trip_id,member_id,note) VALUES('',$idofthistrip,$userid,$notejustgiven)"; $result5 = @mysql_query ($query5); } }else{echo '<strong>You can\'t revote !<br /><br /></strong>';} }$query = "SELECT COUNT(comment_id) AS commentsFROM comment_tripsWHERE id_of_trip=$idofthistrip";$result = mysql_query ($query, $dbc);$row = mysql_fetch_array ($result, MYSQL_BOTH); $totalcomments = "{$row['comments']}";echo '<p style="margin-top:0px;"><a href="#comment">Comments (' . $totalcomments . ')</a></p>';$query2 = "SELECT COUNT(member_id) AS whovotedFROM note_tripsWHERE trip_id = $idofthistrip";$result2 = mysql_query ($query2, $dbc);$row2 = mysql_fetch_array ($result2, MYSQL_BOTH);$totalvotes = "{$row2['whovoted']}";if($totalvotes>1){$phrase = "(rated by " . $totalvotes . " members)";}else{$phrase = "(rated by " . $totalvotes . " member)";}$query3 = "SELECT ROUND(AVG(note),1) AS AVFROM note_tripsWHERE trip_id=$idofthistrip";$result3 = mysql_query ($query3, $dbc);$row3 = mysql_fetch_array ($result3, MYSQL_BOTH);$average = "{$row3['AV']}";$query4 = "SELECT member_id, trip_id, noteFROM note_tripsWHERE member_id = $userid AND trip_id = $idofthistrip";$result4 = mysql_query ($query4, $dbc);$row4 = mysql_fetch_array ($result4, MYSQL_BOTH);$yougave = "{$row4['note']}";if($yougave){echo '<p>Report quality: <b>' . $average . '/5</b> <small>' . $phrase. '<br />You have already voted, you gave this report ' . $yougave . '/5</small></p>';}elseif($average && !$yougave){echo '<p>Report quality: <b>' . $average . '/5</b> <small>' . $phrase . '</small><br />';echo '<b>You have not yet rated this field trip !</b>';echo "<form action=\"$thispage\" method=\"get\" id=\"note\" > <select name=\"note\" onchange=\"MM_jumpMenu('parent',this,0)\"> <option value=\"\">Rate this Report</option>\n"; $query7 = "SELECT id_note FROM note_name ORDER BY id_note ASC"; $result7 = mysql_query ($query7, $dbc); while ($row7= mysql_fetch_array ($result7, MYSQL_BOTH)) { echo"<option name=\"note\" value=\"$thispage?n={$row7['id_note']}\">{$row7['id_note']}</option>\n"; } echo '</select></form>';}elseif(!$average){echo '<b>This field trip has not yet been evaluated, be the first !</b>';echo "<form action=\"$thispage\" method=\"get\" id=\"note\" > <select name=\"note\" onchange=\"MM_jumpMenu('parent',this,0)\"> <option value=\"\">Rate this Report</option>\n"; $query7 = "SELECT id_note FROM note_name ORDER BY id_note ASC"; $result7 = mysql_query ($query7, $dbc); while ($row7= mysql_fetch_array ($result7, MYSQL_BOTH)) { echo"<option name=\"note\" value=\"$thispage?n={$row7['id_note']}\">{$row7['id_note']}</option>\n"; } echo '</select></form>'; }echo'</div>'; //the content of my page $query9 = "SELECT first_name, last_name, comment, DAYOFMONTH(ADDDATE(date, INTERVAL 9 HOUR)) AS day, MONTH(ADDDATE(date, INTERVAL 9 HOUR)) AS month, YEAR(ADDDATE(date, INTERVAL 9 HOUR)) AS year, HOUR(ADDDATE(date, INTERVAL 9 HOUR)) AS hour, MINUTE(ADDDATE(date, INTERVAL 9 HOUR)) AS minsFROM users, comment_tripsWHERE comment_trips.id_of_member = users.user_id AND id_of_trip=$idofthistrip ORDER BY comment_id ASC";$result9 = mysql_query ($query9, $dbc); echo '<div id="comments"><a name="comment"></a><h3 style="margin-top:0px;">Comments (' . $totalcomments . ')</h3><table border="0" width="650" cellspacing="1" cellpadding="1" align="center">'; while ($row9 = mysql_fetch_array ($result9, MYSQL_BOTH)) {echo "<tr><td align=\"left\" valign=\"top\" width=\"150px\"> <b>{$row9['first_name']} {$row9['last_name']}</b> </td><td align=\"left\" valign=\"top\"> {$row9['comment']}<br /><br /> <small>{$row9['day']}/{$row9['month']}/{$row9['year']} {$row9['hour']}h";echo str_pad($row9['mins'],2,"0",STR_PAD_LEFT);echo " - (CET)</small><hr /></td></tr>\n";}echo '</table>';echo '<a name="comment_form"></a><form id="overDiv" name="form1" method="post" action="#comment_form"><label><textarea name="commentinput" cols="35" rows="5" id="commentinput" onKeyUp="toCount(\'commentinput\',\'sBann\',\'{CHAR} characters left\',500);"></textarea></label><p><label><input type="submit" name="Submit" value="Send comment" /></label></p><span id="sBann" class="minitext">500 characters left.</span></form>';echo '<hr style="clear:both" /></div>'; ?> Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.