Re: re: some problems with php form
| From: | Chris | Date: | Tue, 18 Oct 2005 05:26:50 +0000 |
| Subject: | Re: re: some problems with php form | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-224264@lists.php.net to get a copy of this message | ||
Bruce Gilbert wrote:
---------- Forwarded message ---------- From: "Richard Lynch" <ceo@l-i-e.com> To: "Mark Rees" <mrees@itsagoodprice.com> Date: Mon, 17 Oct 2005 15:12:50 -0500 (CDT) Subject: Re: [PHP] Re: a couple of problems with PHP form On Mon, October 17, 2005 5:32 am, Mark Rees wrote:This is how I would do what it looks like you're trying to do. <input class="<?php echo !empty($error_msg)?'error':'normal'?>" id="firstname" name="firstname" type="text" value="<?php echo htmlspecialchars($_POST['firstname'])?>" /> Chris----------------------------------------------------- sorry, my editor has not indented again ----------------------------------------------------- also, I want the field to appear hilighted when there is no information so I am doing this: <input class="<? if($error_msg){ echo "error"; } ELSE { echo "normal"; } id="firstname" name="firstname" type="text" value="{$_POST['firstname']}"? />"I think the quote mark balancing is messed up here...<input class=" this starts a quote for the class= There appears to be no ending quote for that...I>t may simply have been lost in email editing, however... adding the input.error didn't solve the problem dang it.! If there is a ending quote missing, I don't see it right off hand. I know have: <input class="<? if($error_msg){ echo "input.error"; } ELSE { echo "input.normal"; } id="firstname" name="firstname" type="text" value="{$_POST['firstname']}"? />" Shouldn't you jsut be echoing "error" or "normal" . A period isn't allowed in a class dafinition, and the css will work for all elements of type input with a class of error. Also you don't seem to be closing the PHP tag at the right place
in the css: input.error { border: 2px inset red; margin:0; font-family: arial, helvetica, sans-serif; color: #036; width: 15em; padding-left: .25em; font-weight: bold; background: #eee; }