Killermud
03-09-2009, 06: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.
<table>
<tr><form action="" method="post">
<td>
Catergory Name
</td>
<td><input name="catname" id="catname" type="text">
</td>
</tr>
<tr>
<td><input name="catadd" id="catadd" type="submit" value="Add new Catergory"></td>
</tr></form>
</table>
<?
}
if(isset($_POST['catadd'])){
$catname=$_POST['catname'];
echo "worked";
$sql="INSERT INTO forums forum_title='$catname' forum_type='1'";
$result=mysql_query($sql);
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.
Unfortantly i try submitting the data and the if statement i use doesnt pick up that the button has been pressed.
<table>
<tr><form action="" method="post">
<td>
Catergory Name
</td>
<td><input name="catname" id="catname" type="text">
</td>
</tr>
<tr>
<td><input name="catadd" id="catadd" type="submit" value="Add new Catergory"></td>
</tr></form>
</table>
<?
}
if(isset($_POST['catadd'])){
$catname=$_POST['catname'];
echo "worked";
$sql="INSERT INTO forums forum_title='$catname' forum_type='1'";
$result=mysql_query($sql);
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.