Jump to content

form trouble


Go to solution Solved by Ch0cu3r,

Recommended Posts

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

 

 

Link to comment
https://forums.phpfreaks.com/topic/284857-form-trouble/
Share on other sites

  • Solution

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 by Ch0cu3r
Link to comment
https://forums.phpfreaks.com/topic/284857-form-trouble/#findComment-1462775
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

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.