I have a sign-up form, it has a checkbox beside the email field (to either show or hide the email address on the users profile page, etc) but also, it will add the username, email, password, etc to the database as well.
So the problem is, I can verify the checkbox is checked or not checked, but the way i'm doing this is I have a field set to 0 default, Via the UPDATE command I will change it to one (to hide the email, 0 to show, get it?)
I dont think you need any code, but heres a cheap example of what I got going:
Code: Select all
<?php
$sql = "SELECT username FROM users WHERE username='$username'";
$result = mysql_query($sql);
$row = mysql_fetch_array($result);
$user = $row['username'];
if ($user == "") {
$sql = mysql_query("INSERT INTO users (username, password, email, aim) VALUES ('$username', '$password', '$email', '$aim')");
echo "Thank you for signing up";
if ($showemail) { //$showemail is the name of the checkbox input
$sql = "UPDATE users SET semail=1 WHERE username='$user'";
$result = mysql_query($sql) or die(mysql_error);
}
}
...
?>how can I go about doing this?
***marked solved : by infolock***