Kazlaaz Posted October 5, 2006 Share Posted October 5, 2006 I'm having trouble getting my if(isset($_POST['form_sub'])) to validate true when submitting a form, where the form name is 'form_sub'. The value always seems to validate as false or NULL. I've tried using a hidden input field also. Basically when I hit submit or enter, with information typed in the first field or all the fields, the result is never true, so it just loops back around to the beginning.I am using PHP5, Firefox and IE browers. Not sure what other information would be useful.Any help would be appreciated, thank you.[code]<?php if (isset($_POST['form_sub'])) { echo 'Testing Submit:<br>'; echo 'header: '.$_POST['header'].'<br>'; exit; }?><?php if (isset($_GET['add'])) {?><form name="FormName" action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post"><table width="500" border="0" cellspacing="1" bgcolor="#000000"> <tr bgcolor="#FFFFFF"> <td width="150">News Header </td> <td><input name="header" type="text" /></td> </tr> <tr bgcolor="#FFFFFF"> <td>News Headline </td> <td><input name="headline" type="text" /></td> </tr> <tr bgcolor="#FFFFFF"> <td>News</td> <td><textarea name="news"></textarea></td> </tr> <tr bgcolor="#FFFFFF"> <td> </td> <td><input name="featured" type="checkbox" value="1" /> Featured <input name="active" type="checkbox" value="1" /> Active </td> </tr> <tr bgcolor="#FFFFFF"> <td> </td> <td align="right"> <input name="form_sub" type="submit" value="Submit" /></td> </tr></table></form><?php } else {?><a href="<?php $_SERVER['PHP_SELF']; ?>?add=1">Add news item</a><?php } // end main if?>[/code] Link to comment https://forums.phpfreaks.com/topic/23062-value-is-always-falsenull-when-submitting-a-form/ Share on other sites More sharing options...
Hi I Am Timbo Posted October 5, 2006 Share Posted October 5, 2006 I don't think submit values post. You can see what is and what is not posting by doing var_dump($_POST);But I wouldn't expect it to post. If you really need the value form_sub to post, put it in a hidden with whatever value you want. Link to comment https://forums.phpfreaks.com/topic/23062-value-is-always-falsenull-when-submitting-a-form/#findComment-104199 Share on other sites More sharing options...
brown2005 Posted October 5, 2006 Share Posted October 5, 2006 i dont understand what you mean is wrong.. i have entered info in the form and submitted and it works.. it prints the header.. Link to comment https://forums.phpfreaks.com/topic/23062-value-is-always-falsenull-when-submitting-a-form/#findComment-104204 Share on other sites More sharing options...
Kazlaaz Posted October 5, 2006 Author Share Posted October 5, 2006 It seems my settings are wrong somewhere then, it definately does not work for me.When I use var_dump($_POST); I get this before i submit, and after: array(0)Then I tried to add a hidden field:[code]<input name="submitted" type="hidden" value="true">[/code]And changed the line 2 php code to:[code]if (isset($_POST['submitted']))[/code]Still nothing.When I var_dump($_POST); that I get the same thing before and after the submit button is pushed: array(0)EDIT: Seems to be my server settings, tried a different server and it works fine. Thanks everyone. Now to figure out what's wrong with my server. Link to comment https://forums.phpfreaks.com/topic/23062-value-is-always-falsenull-when-submitting-a-form/#findComment-104257 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.