if(isset($todo) and $todo=="test"){
if (!eregi("^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$", $email)){
echo "<center>Invalid email</center>";
}else{
echo "<center>Valid Email</center>";}
}
Wednesday, March 2, 2011
Email format validation in Php using regular expressions
Saturday, February 26, 2011
DESPERATE- gettin checkbox values in POST (PHP)
- <html>
- <head>
- <title>checkbox help</title>
- </head>
- <?
- if (isset($HTTP_POST_VARS)) {
- $fruit = $HTTP_POST_VARS["fruit"];
- echo("Fruits chosen: " . count($fruit) . "<br><br>");
- if (count($fruit)>0) {
- echo("You chose the following fruits:<br>");
- }
- for ($i=0; $i<count($fruit); $i++) {
- echo( ($i+1) . ") " . $fruit[$i] . "<br>");
- }
- }
- ?>
- <body bgcolor="#ffffff">
- <form method="post">
- Choose a fruit:<br><br>
- <input type="checkbox" name="fruit[]" value="apples">apples <br>
- <input type="checkbox" name="fruit[]" value="oranges">oranges <br>
- <input type="checkbox" name="fruit[]" value="peaches">peaches <br>
- <input type="checkbox" name="fruit[]" value="mangos">mangos<br>
- <input type="submit">
- </form>
- </body>
- <html>
Sunday, February 20, 2011
Javascript validation for URL
function is_valid_url(url)
{
return url.match(/^(ht|f)tps?:\/\/[a-z0-9-\.]+\.[a-z]{2,4}\/?([^\s<>\#%"\,\{\}\\|\\\^\[\]`]+)?$/);
}
Subscribe to:
Posts (Atom)