Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $servername = "localhost";
- $username = "root";
- $password = "";
- $conn = mysql_connect ($servername , $username , $password) or die("unable to connect to host");
- $sql = mysql_select_db ('vcet',$conn) or die("unable to connect to database");
- //code to insert into db...change the ussername and eamil to the respective fields in the form....
- $user_info = "INSERT INTO studentinfo (user_name, roll_number, user_batch,user_from,user_year, user_level, F_name, m_name, g_name, mob_number, addressline1, addressline2, city, pmob_number, land_number, cutoff, dept, medium, locality, intrest, scholar, income, user_caste, user_admit, user_stay) VALUES ('".$_POST[user_name]."', '".$_POST[roll_number]."','".$_POST[user_batch]."','".$_POST[user_from]."','".$_POST[user_year]."','".$_POST[user_level]."','".$_POST[F_name]."','".$_POST[m_nam e]."','".$_POST[g_name]."','".$_POST[mob_number]."','".$_POST[addressline1]."',' ".$_POST[addressline2]."','".$_POST[city]."','".$_POST[pmob_number]."','".$_POST [land_number]."','".$_POST[cutoff]."','".$_POST[dept]."','".$_POST[medium]."','" .$_POST[locality]."','".$_POST[intrest]."','".$_POST[scholar]."','".$_POST[incom e]."','".$_POST[user_caste]."','".$_POST[user_admit]."','".$_POST[user_stay]."') ";
- if (!mysql_query($user_info, $connect)) { die('Error: ' . mysql_error()); } echo “Your information was added to the database.”;
- mysql_close($connect);
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement