mysql - date and phone number format in php -
i trying data user , store database using php. when add date & phone number , store 1st number of date entered & random number in phone number.
$fname = $_get['fname']; $lname = $_get['lname']; $mname = $_get['mname']; $dob = $_get['dob']; $pnumber = $_get['pnumber']; $occupation = $_get['occupation']; $joindate = $_get['join date']; $ffname = $_get['ffname']; $flname = $_get['flname']; $peraddress = $_get['peraddress']; $fpnumber = $_get['fpnumber']; $mpnumber = $_get['mpnumber']; $roomnumber = $_get['roomnumber']; $deposite = $_get['deposite']; //$password = $_get['password']; //$sha1password = sha1($password); //create connection $connection = mysqli_connect('localhost', 'root', 'root', 'hostel'); //check connection if ($connection->connect_error) { die('connection error (' . $connection->connect_errno . ') ' .$connection->connect_error); } echo 'cool!' .$connection->host_info . "\n"; $sqlin = "insert student (first_name, last_name, middle_name, date_of_birth, phone_number, occupation, join_date, father_first_name, father_last_name, permenent_address, father_phone_number, mother_phone_number, room_number, deposite) values ('$fname', '$lname', '$mname', '$dob', '$pnumber', '$occupation', '$joindate', '$ffname', '$flname', '$peraddress', '$fpnumber', '$mpnumber', '$roomnumber', '$deposite')"; if ($connection->query($sqlin) === true) { echo"thank you! info has been entered database"; }else{ echo"error: " . $sqlin . "<br>" . $connection->error; } $connection->close(); ?>
i set date type date in html , phone number text. how can correct date format calender option , phone number ?
since posting data form using _get, might have caused problem date when saving in database. change form post method 'post' , read posted values using $_post
Comments
Post a Comment