Jump to content


Photo

:@:@:@ form not working again!


  • Please log in to reply
2 replies to this topic

#1 Nothadoth

Nothadoth
  • Members
  • PipPipPip
  • Advanced Member
  • 119 posts

Posted 17 August 2006 - 01:34 AM

I am using this form to edit the text in the About Us page.

It keeps giving me the error: You did not fill out the form properly. What have I done wrong?????

$mode = $_GET['mode'];

if ($mode == "") {
  print "<table border='1' cellpadding='0' cellspacing='0' style='border-collapse: collapse' bordercolor='#000000' width='100%'>
  <tr>
    <td width='100%' height='27' background='".$ROOT."styles/images/contbar.jpg'><center><span class='t1'>CHANGE ABOUT US</span></center></td>
  </tr>
  <tr>
    <td width='100%'><div align='center'>
  <center>
  <table border='0' cellpadding='0' cellspacing='0' style='border-collapse: collapse' width='95%'>
    <tr>
      <td width='100%'><span class='t2'>";
      
 mysql_connect('localhost','hidden','hidden'); 
mysql_select_db('hidden_igbltduk'); 		  
$aboutquery= mysql_query("SELECT * FROM about ORDER BY id DESC LIMIT 1");
while($about = mysql_fetch_array($aboutquery)) { 
      
      print "<form method='POST' action='aboutedit.php?mode=change'>
<center><table border='0' cellpadding='2' cellspacing='0' style='border-collapse: collapse'>
    <tr>
      <td width='200' height='22' align='center' valign='top'><span class='t2'>Body<br><br>
	  Note: The text already in the text box is what is currently in the About Us page!<br>
      <br>
      <b>HTML Help</b><br>
      Use these codes in the text box to help you.<br>
      <br>
      New line: &lt;br&gt;</span></td>
      <td height='22'><textarea rows='20' name='body' cols='30'>".$about['body']."</textarea></td>
    </tr>
  </table></center>
  <center>  <input type='submit' value='Submit' name='submitabout'><input type='reset' value='Reset' name='resetabout'></center>
</form>";
      
}
	  
print "</span></td>
    </tr>
  </table>
  </center>
</div>
</td>
  </tr>
</table>
";
} elseif ($mode == "change") {
  
  $body = $_GET['body'];
  
  if ($body == "") {
    print "<table border='1' cellpadding='0' cellspacing='0' style='border-collapse: collapse' bordercolor='#000000' width='100%'>
  <tr>
    <td width='100%' height='27' background='".$ROOT."styles/images/contbar.jpg'><center><span class='t1'>ERROR</span></center></td>
  </tr>
  <tr>
    <td width='100%'><div align='center'>
  <center>
  <table border='0' cellpadding='0' cellspacing='0' style='border-collapse: collapse' width='95%'>
    <tr>
      <td width='100%'><span class='t2'>";
      
 
      
      print "You did not fill in the form properly!";
      

	  
print "</span></td>
    </tr>
  </table>
  </center>
</div>
</td>
  </tr>
</table>
";

} else {

  print "<table border='1' cellpadding='0' cellspacing='0' style='border-collapse: collapse' bordercolor='#000000' width='100%'>
  <tr>
    <td width='100%' height='27' background='".$ROOT."styles/images/contbar.jpg'><center><span class='t1'>ABOUT US CHANGED</span></center></td>
  </tr>
  <tr>
    <td width='100%'><div align='center'>
  <center>
  <table border='0' cellpadding='0' cellspacing='0' style='border-collapse: collapse' width='95%'>
    <tr>
      <td width='100%'><span class='t2'>";
      
 mysql_connect('localhost','hidden','hidden'); 
mysql_select_db('hidden_igbltduk'); 		  
$aboutquery= mysql_query("UPDATE about SET body = '$body'");

      
      print "About us page successfully changed!";
      

	  
print "</span></td>
    </tr>
  </table>
  </center>
</div>
</td>
  </tr>
</table>
";
}

}

Thank you

#2 hitman6003

hitman6003
  • Members
  • PipPipPip
  • Advanced Member
  • 1,807 posts

Posted 17 August 2006 - 01:40 AM

You form method is post, but you are using the get array:

} elseif ($mode == "change") {
  
  $body = $_GET['body'];
  
  if ($body == "") {
    print "<table border='1' cellpadding='0' cellspacing='0' style='border-collapse: collapse' bordercolor='#000000' width='100%'>
  <tr>....

Change that to
$body = $_POST['body'];


#3 Nothadoth

Nothadoth
  • Members
  • PipPipPip
  • Advanced Member
  • 119 posts

Posted 17 August 2006 - 01:44 AM

Stupid error. That's from staying up late doing this.

Thank you




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users