This is my php page where form data is sent to and data is added to database.With this I radio button data doesn't get inserted.Also I tried to modify this using mysqli_real escape(). with the function
<?phpfunction safe($value){ return mysql_real_escape_string($value);}?>
and in code as$username = safe($_POST["username"]); $password = safe($_POST["password"]); But then no data gets inserted to database and errors occur.I am completely new to this so any help please? This is my code.Why doesn't radio button data get inserted?
<?phpsession_start();// If user is logged in, header them awayif(isset($_SESSION["username"])){exit();}$connect=mysqli_connect("localhost","root","","cs1");//check cnnectionif (mysqli_connect_errno($connect)){echo "Failed to connect database".mysqli_connect_error();exit();}$username=$_POST["username"];$password1=$_POST["password1"];$password2=$_POST["password2"];$gender=$_POST["gender"];$sql="INSERT INTO users (username,email,password1,password2,gender) VALUES ('$username','$_POST[email]','$password1','$password2','$gender' )";$query = mysqli_query($connect, $sql);