Jump to content

displaying post variables in a text area.


barrowvian

Recommended Posts

I had a basic contact form in place at the moment.

 

When Im using a simple text field everything works fine;

				echo '<tr>
			<td width="10%" align="left" valign="top">Full Name:</td>
			<td width="20%" align="left"><input type="text" name="name" style="width: 200px" value="'; 
			if ($errorName_Field) echo $_POST['name'];  
			if (isset($_POST['name']) && $errorName_Field==false) echo $_POST['name'];
			echo '" /></td>
			<td width="70%" align="left">'; if ($errorName_Field) echo "$errorTextName_Field"; echo '</td>';
			echo '</tr>';

 

If the input is incorrect then is keeps it there for the user to edit along with displaying an error message. If the input is correct it keeps it there too but doesnt display the message.

 

My problem is when it comes to using the same function with a text area. I use pretty much the same code;

				echo '<tr>
			<td width="10%" align="left" valign="top">Message:</td>
			<td width="20%"align="left"><textarea rows="5" name="message" style="width: 199px;" value="';
			if ($errorMessage || $errorMessage1) echo $_POST['message']; 
			if (isset($_POST['message']) && $errorMessage==false && $errorMessage1==false) echo $_POST['message'];
			echo '" /></textarea></td>';
			echo '<td width="70%" align="left">'; if ($errorMessage) echo "$errorTextMessage"; if ($errorMessage1) echo
			"$errorTextMessage1"; 	echo '</td>';
			echo '</tr>';

 

But for some reason it doesnt work at all. It doesnt keep the input within the area no matter if the input is correct or incorrect. Is there something I have to do different with it being a text area?

 

Ive done a simple echo to return the value of what is inserted upon submission and that works, but it doesnt when its in the text area.

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.