Lone_Ranger Posted December 19, 2013 Share Posted December 19, 2013 this is my if statement when the submit is made if ($action == "blogpost") { if (empty($blogarticle)) { echo "<p align=center>Sorry your Blog was not posted due to the Article section being blank. You will be redirected in a few seconds so please try again</p> <p align=center>If you have not returned to your page <a href=http://www.sentuamessage.com/controlpanel.php?action=blog>Click Here</a>"; echo "<meta http-equiv=refresh content=15;URL=http://www.sentuamessage.com/controlpanel.php?action=blog />"; } else if (empty($blogtopic)) { echo "<p align=center>Sorry your Blog was not psoted due to the Topic section being blank. You will be redirected in a few seconds so please try again</p> <p align=center>If you have not returned to your page <a href=http://www.sentuamessage.com/controlpanel.php?action=blog>Click Here</a>"; echo "<meta http-equiv=refresh content=15;URL=http://www.sentuamessage.com/controlpanel.php?action=blog />"; } else { echo "success"; } <form method=POST action=http://www.sentuamessage.com/controlpanel.php?action=blogpost> <div align=center> <table border=0 width=63% cellspacing=0 cellpadding=0> <tr> <td><img src=http://www.sentuamessage.com/commenttop.jpg></img></td> </tr> <tr> <td background=http://www.sentuamessage.com/commentmiddle.jpg> <table border=0 width=100% cellspacing=0 cellpadding=0> <tr> <td width=13> </td> <td valign=top> <table border=0 width=99% cellspacing=0 cellpadding=0> <tr> <td valign=top> <table border=0 width=99% cellspacing=0 cellpadding=0> <tr> <td width=129><img src=http://www.sentuamessage.com/controlpanel/blogtitle.jpg></img></td> <td> <table border=0 width=100% cellspacing=0 cellpadding=0> <tr> <td width=16> </td> <td> </td> </tr> <tr> <td width=16> </td> <td> <input type=text name='blogtopic' size=103 maxlength=250 style='outline: none; overflow: hidden; border: none'></td> </tr> <tr> <td width=16> </td> <td> </td> </tr> </table> </td> </tr> </table> </td> </tr> <tr> <td><img src=http://www.sentuamessage.com/controlpanel/blogarticle.jpg></img><p><textarea type=text name='blogarticle' cols=107 rows=21 style='outline: none; overflow: hidden; border: none'></textarea></td> </tr> <tr> <td><p align=right><input type=image name=submit src=http://www.sentuamessage.com/commentpost.jpg value=send border=0 ></td> </tr> </table> </td> <td width=4> </td> </tr> </table> </td> </tr> <tr> <td><img src=http://www.sentuamessage.com/commentbottom.jpg></img></td> </tr> </table> </div> </form> the above is the form, each time you submit the form it says ARTICLE is empty when it isn't so it fails Quote Link to comment Share on other sites More sharing options...
Ch0cu3r Posted December 19, 2013 Share Posted December 19, 2013 (edited) Where is $blogarticle and $blogtopic defined? If you have not defined them yet then you need to use $_POST['blogarticle'] and $_POST['blogtopic'] instead. Edited December 19, 2013 by Ch0cu3r Quote Link to comment Share on other sites More sharing options...
Lone_Ranger Posted December 19, 2013 Author Share Posted December 19, 2013 I had them as if ($_POST['blogarticle'] || $_POST['blogtopic' ] == "") { but still the same outcome where it wouldn't accept it Quote Link to comment Share on other sites More sharing options...
Solution Ch0cu3r Posted December 19, 2013 Solution Share Posted December 19, 2013 (edited) You need to check both variables values if ($_POST['blogarticle'] == "" || $_POST['blogtopic' ] == "") { // one or bott fields are empty } // OR alternatively use if (empty($_POST['blogarticle']) || empty($_POST['blogtopic' ])) { // one or both fields are empty } Edited December 19, 2013 by Ch0cu3r Quote Link to comment Share on other sites More sharing options...
Lone_Ranger Posted December 19, 2013 Author Share Posted December 19, 2013 working now, wont work if I do the || statement but works if I do the IF statements seperatly Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.