a few things I am trying to do with PHP form aren't working
Posted: Tue Oct 11, 2005 10:08 pm
I have added the follow code to try and validate the email part of my form, but it doesn't seem to be working.
the form can be found at: http://www.inspired-evolution.com/Contact_Form.php
what I want is legimate characters must be entered in the email field, so what I have added is:
the form part is:
<input id="email" name="email" type="text" value="{$_POST['email']}" />
another function that isn't working is I wanted the form field to be hilighted when no information is entered, so I tried this:
and to my css:
form.info_request input.normal {
border: 2px inset #666;
margin:0;
font-family: arial, helvetica, sans-serif;
color: #036;
width: 15em;
padding-left: .25em;
font-weight: bold;
background: #eee;
}
form.info_request 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;
}
this doesn't work either.
Please advise as to how I can get these ideas to work!
the form can be found at: http://www.inspired-evolution.com/Contact_Form.php
what I want is legimate characters must be entered in the email field, so what I have added is:
Code: Select all
if(!eregi("^(.+)@(.+)\\.(.+)$",$_POST['email']))
{
$error_msg .= "<BR />Your email appears to be invalid.";
$ok = "false";
}<input id="email" name="email" type="text" value="{$_POST['email']}" />
another function that isn't working is I wanted the form field to be hilighted when no information is entered, so I tried this:
Code: Select all
<input class="<? if($error_msg){ echo "error"; } ELSE { echo
"normal"; } id="firstname" name="firstname" type="text" value="{$_POST['firstname']}"? />"form.info_request input.normal {
border: 2px inset #666;
margin:0;
font-family: arial, helvetica, sans-serif;
color: #036;
width: 15em;
padding-left: .25em;
font-weight: bold;
background: #eee;
}
form.info_request 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;
}
this doesn't work either.
Please advise as to how I can get these ideas to work!