PHP headaches...
- Started
- Last post
- 17 Responses
- rabattski0
dude, i would use javascript check if those fields are wrong and/or empty and give an alert if it's the case.
else
if (empty($name) || empty($email || $name=="Your Name:" || $email=="Your Email:")
etc.
- fifty500
hah, sh*t... I was trying to write it like
$name="Your Name:" etc...
it's stupid cause i only had forgotten one of the equal signs, and using 2 came to mind, but i never tried it.
*walks outside and smashes teeth on the curb*
- rabattski0
mwaaaaaahahahahahhahahahhahahaaa... roflmao. oh god, i'm sorry, i know how that feels like. :)
- fifty500
now, how can i make it so that if there's not a seemingly valid email address in the 'email' field, it also gives an error? i.e. anything containing the @ symbol
right now, you can type "asdf" and "asdf", for example, in both fields and it takes this as valid.
- rabattski0
by using ereg.
http://de2.php.net/manual/en/fun…
example:
function is_email($email) { return ereg("^[^@ ]+$", $email);}
- fifty500
I'm still confused though, where do I put that in my php script so that it points to my error url? ($errorurl)
- fifty500
i've sent you an email with more details. maybe you could help if you have some time...
- unfittoprint0
if (empty($name) || $name == 'Your Name:' || empty($email) || $email == 'Your email:') {
header( "Location: $errorurl" );
exit;
}should be enough.
- rabattski0
5050, you got mail.
- fifty500
thx unfit, but i've already got that in my code. i just need to insert some code to make it check if the email address is indeed valid, or we could be spammed with stuff like
Name: asdf
Email:
- unfittoprint0
oh and
is a valid email adress
but u will not be able to check if it /its host really exists.
- fifty500
well i found a code to check if the hosts actually exists:
http://www.developer.com/lang/ph…
I'd love to use it, but i'm not experienced enough with PHP to know how to incorporate it with my existing code. i'm just a graphic designer, not a programmer.
- unfittoprint0
nice, nice....
damn' I'm going to include that in my scripts....
just wondering if all the hosts allow their email records to be read....
thx!
- fifty500
lol
I have no idea. If my script would work, then I'd tell you :P