Echo variable within a span

I was wondering if anyone can help me… I’ve got a variable that is printed if an input box is left empty, the thing is i need to be able to change the appearance using a . I’ll put the code below so you can see what i mean…

<tr><td align="left">Year: <span style="font-size:8pt; color:red;">(Required)</span></td> <td align="left"><?php echo '<select name="year">'; echo '<option value=""></option>'; for($x = 1950; $x <= 2007; $x++) { echo "<option value=$x"; if($_POST['year']==$x) echo ' selected="selected"'; echo ">$x</option>"; } echo "</select> "; echo $year_error; <-- This is the bit that i need to put inside a <span>, how do i do it without annoying php? ?></td></tr>

Do you mean something like this the following:

[php]<?php
//Your Code
?>
<?php echo $year_error; ?>

<?php //More PHP Code ?>[/php]

You can jump in and out of PHP anytime. Its been proven best to keep as much HTML out of the PHP as possible.

Spot on. Thanks. :D

Sponsor our Newsletter | Privacy Policy | Terms of Service