View Full Version : Form will not submit

03-09-2009, 07:31 PM
Hi im trying to have a form that will submit data into my database.

Unfortantly i try submitting the data and the if statement i use doesnt pick up that the button has been pressed.

<tr><form action="" method="post">
Catergory Name
<td><input name="catname" id="catname" type="text">
<td><input name="catadd" id="catadd" type="submit" value="Add new Catergory"></td>

echo "worked";
$sql="INSERT INTO forums forum_title='$catname' forum_type='1'";

I added 'echo "worked"' so that i could tell if its the if statement or the SQL statement but, i do not see 'worked' appear, which states its the if statement or the form. But i cannot figure where it goes wrong.

03-09-2009, 07:40 PM
Add echo "<pre>".print_r($_POST,true)."</pre>"; to the very top of the script and see what that shows you.

03-09-2009, 07:54 PM
Remove the action="" in your <form>, just don't add it at all to see if it does anything different. If it still doesn't work add the following:

<form action="<?php echo $_SERVER['REQUEST_URI']; ?>"...

03-09-2009, 08:56 PM
ok Fumigator i did that and this is what came up.

[forumtype] => 1
[forumsubmit] => Submit
i had to put it before my if statement because it would not do anything otherwise.

Leppy, even with that code it still doesnt work.

EDIT: Ok solved it, it was further up my code. It was inside another if statment and that seemed to cause a problem.