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
https://forums.phpfreaks.com/topic/159318-solved-error-message-not-displaying/
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>';

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.