QUOTE(BetaWar @ 16 Jul, 2008 - 01:21 PM)

Well, we will need to see your code before we post some, but you may want to look into a javascript check for the form onsubmit function so that it takes a look at certain input value lengths and compares them to the amount allowed.
Ok, could you possibly just simply send me the updated code with the validation techniques in, I would like the following:
Block Naughty words.
Refuse to submit if the fields are empty
Refuse to submit if the email fied does not contain an @
Require atleast 1 number in the password field.
Thanks.
FORM CODE:
CODE
<form action="insert.php" method="post">
<table width="393" height="269" border="8" align="center" cellpadding="0" cellspacing="0" bordercolor="#FFFFFF">
<tr>
<td width="375" height="253" bgcolor="#0033CC"><table width="397" height="240" border="0" cellpadding="0" cellspacing="0">
<tr>
<td height="30"> <div align="center"><span class="style45"><span class="style37">Name</span></span></div></td>
<td><div align="center" class="style37">:</div></td>
<td><span class="style45">-</span>
<input name="name" type="text" id="name" size="35" maxlength="25" minlength="5" />
</td>
</tr>
<tr>
<td width="89" height="30"><div align="center"><span class="style37"> Username</span></div></td>
<td width="10"><div align="center" class="style37">:</div></td>
<td width="298"><span class="style45">-</span>
<input name="username" type="text" id="username" size="35" />
</td>
</tr>
<tr>
<td height="30"><div align="center"><span class="style37">Password</span></div></td>
<td><div align="center" class="style37">:</div></td>
<td><span class="style45">-</span>
<input name="password" type="password" id="password" size="35" />
</td>
</tr>
<tr>
<td height="30"><div align="center"><span class="style37">Country</span></div></td>
<td><div align="center" class="style37">:</div></td>
<td><span class="style45">-</span>
<input name="country" type="text" id="country" size="35" />
</td>
</tr>
<tr>
<td height="30"><div align="center"><span class="style37">Email</span></div></td>
<td><div align="center" class="style37">:</div></td>
<td><span class="style45">-</span>
<input name="email" type="text" id="email" size="35" />
</td>
</tr>
<tr>
<td height="30" valign="top"><div align="center">
<p class="style37">Profile</p>
</div></td>
<td valign="top"><div align="center" class="style37"><br />:</div></td>
<td><span class="style45">-</span>
<textarea name="profile" cols="27" rows="8" id="profile"></textarea>
</td>
</tr>
<tr>
<td height="30" valign="top"><div align="center"><span class="style37">CaPtChA</span></div></td>
<td valign="top"><div align="center"><span class="style37">:</span></div></td>
<td><p align="left" class="style45"><?php
require_once('recaptchalib.php');
$publickey = "6Ld5fAIAAAAAAJNGHh9RoXaQD0mOn6vvdEUh4-vs";
$privatekey = "6Ld5fAIAAAAAACQ5ZAY1RUzF6RYF8A8d_w9BQtzJ";
# the response from reCAPTCHA
$resp = null;
# the error code from reCAPTCHA, if any
$error = null;
# are we submitting the page?
if ($_POST["submit"]) {
$resp = recaptcha_check_answer ($privatekey,
$_SERVER["REMOTE_ADDR"],
$_POST["recaptcha_challenge_field"],
$_POST["recaptcha_response_field"]);
if ($resp->is_valid) {
echo "You got it!";
# in a real application, you should send an email, create an account, etc
} else {
# set the error code so that we can display it. You could also use
# die ("reCAPTCHA failed"), but using the error message is
# more user friendly
$error = $resp->error;
}
}
echo recaptcha_get_html($publickey, $error);
?>
</p>
</td>
</tr>
<tr>
<td height="30"> </td>
<td> </td>
<td align="right"><input type="submit" />
<input name="Reset" type="reset" value="Reset" />
INSERT.PHP CODE:
CODE
<?php
$con = mysql_connect("sql207.byethost17.com","b17_2102460","CENSORED");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("b17_2102460_members", $con);
$sql="INSERT INTO members (username, password, email, profile)
VALUES
('$_POST[username]','$_POST[password]','$_POST[email]','$_POST[profile]')";
if (!mysql_query($sql,$con))
{
die('Error: ' . mysql_error());
}
echo "1 record added";
mysql_close($con)
?>