Hi, Check this link: http://php.davesolution.com/input_data_mhs.php I try to insert the following data into the form: 0100910054 James Laki 2007 Accounting (I may or may not insert Foto / Photo) Whenever I click submit, it will takes me to the next page, which uses the following codes: <? error_reporting(E_ALL); ini_set('display_errors', '1'); //include ("server.php"); include ("menu.php"); // kata yang di ucwords() akan mempunyai huruf pertamanya // huruf kapital // walaupun sengaja di tulis dalam huruf kecil //$nama = ucwords($nama); $koneksi = mysql_connect ($host, $user, $pass) or die (mysql_error()); mysql_select_db($db) or die (mysql_error()); if ($koneksi) echo "Sukses terhubung ke database MySql"; else echo "Gagal terhubung ke database MySql"; echo "<br>"; // default to no error message $message = ''; if (!$_POST['nim']) $message .= 'Required parameter nim is missing.<br />'; else {$nim = $_POST['nim']; print $_POST['nim'];} if (!$_POST['nama']) $message .= 'Required parameter nama is missing.<br />'; else {$nama = $_POST['nama']; print $_POST['nama'];} if (!$_POST['jk']) $message .= 'Required parameter jk is missing.<br />'; else {$jk = $_POST['jk']; print $_POST['jk'];} if (!$_POST['jurusan']) $message .= 'Required parameter jurusan is missing.<br />'; else {$jurusan = $_POST['jurusan']; print $_POST['jurusan'];} if (!$_FILES['foto']) $message .= 'Required parameter foto is missing.<br />'; else {$foto = $_FILES['foto']; print $_FILES['foto'];} //etc. for each parameter if ($message) // we have an error, so display it { echo $message; // do whatever // and redisplay the form include ("input_data_mhs_form.php"); }else // no errors, so process the data { // Copy file ke dalam folder ../image move_uploaded_file( $_FILES['foto']['tmp_name'], '../image/' . $_FILES['foto']['name'] ) //print $_POST['nim']; //print $_POST['nama']; //print $_POST['jk']; //print $_POST['jurusan']; //print $_FILES['foto']; echo $nim; echo $nama; echo $jk; echo $jurusan; echo $foto; // Karena hanya memasukkan informasi mahasiswa maka // untuk pengisian nilai dan grade di buatkan form tersendiri // sehingga pada file ini dikosongi mysql_query ("INSERT into mhs (nim, nama, jk, jurusan, foto) VALUES ('$nim', '$nama', '$jk', '$jurusan', '$foto')", $koneksi) or die (mysql_error()); } ?> PHP: I wonder why it shows me a blank page to the next page? Thanks for the suggestion
One good way for debugging these blank pages is to use .. as i call it .. 'blah' debugging. It involves putting the code echo 'blah';exit; PHP: at various places and seeing at what place it starts showing the blank page. For example, you place it after the 5th line, check the result. If it shows 'blah' then remove the code and place it after the 10th line. Do it till it shows blank page. When it shows blank page, put the code, one line above, and then again to the one line above till it starts showing 'blah' again. This is a good way to find the exact line causing the error. Though it may be a bit tiring if you dont have a local server as its gonna take a lot of editing. Oh and of course, the error may also be in those files that are being included, menu.php and input_data_mhs_form.php