Jump to content

[SOLVED] Error message not displaying


Recommended Posts

I have the following code:

 

<?php
		if(isset($_POST['submit'])) {
			$name = $_POST['name'];
			$email = $_POST['email'];
			$message = $_POST['message'];

			if($name == '') {
				$submit_msg = '<span class="errormsg">'; 
					$submit_msg = 'There was an error processing your submission. Please try again!';
				$submit_msg = '</span>';
			} else {
				$submit_msg = '<p>Test</p>';
			}

			echo $submit_msg;

		} else {
	?>

		<form action="contactus.php" method="post" id="contactUsForm">
			<p>			
				<strong style="color:#ff0000;">*</strong> <i>is required</i><br/><br/>
				Name:<strong style="color:#ff0000;">*</strong><br/>
				<input type="text" name="name" id="name" class="fInput" style="width:300px;"/>
			</p>

			<p>
				Email:<strong style="color:#ff0000;">*</strong><br/>
				<input type="text" name="email" id="email" class="fInput" style="width:300px;"/>
			</p>

			<p>
				Message:<strong style="color:#ff0000;">*</strong><br/>
				<textarea rows="6" cols="50" class="fInput" style="width:300px;" name="message" id="message"></textarea>
			</p>

			<p>
				<input type="submit" id="submit" value="Submit" name="submit" />
			</p>
		</form>

	<?php } ?>

 

$submit_msg is not displaying for some reason... any suggestions?

Link to comment
Share on other sites

	$submit_msg = '<span class="errormsg">'; 
	$submit_msg = 'There was an error processing your submission. Please try again!';
	$submit_msg = '</span>';

should be

	$submit_msg = '<span class="errormsg">'; 
	$submit_msg .= 'There was an error processing your submission. Please try again!';
	$submit_msg .= '</span>';

Link to comment
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.