Jump to content

Archived

This topic is now archived and is closed to further replies.

Nothadoth

:@:@:@ form not working again!

Recommended Posts

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?????

[code]$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>
";
}

}[/code]

Thank you

Share this post


Link to post
Share on other sites
You form method is post, but you are using the get array:

[code]} 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>....[/code]

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

Share this post


Link to post
Share on other sites

×

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.