mlummus Posted May 14, 2010 Share Posted May 14, 2010 When viewing this program in a browser, I'm getting nothing - no html, no php, no source whatsoever - just white. The page is coming up blank. Any idea why? <html> <head> <title> Student Delete </title> </head> <body> <h1>Student Delete Form </h1> <h2>Select a Student</h2> <?php $db = mysqli_connect("dbserver.com", "user", "password"); if (!db) {echo "Error: Could not connect to database."; exit;} mysqli_select_db("dbname"); $query = "SELECT id from student"; $result = mysqli_query($query); $num_results = mysqli_num_rows($result); echo "<p> Number of students found: ".$num_results."</p>"; echo "<form method='post' action='studentfind.php'>"; echo "ID:" <select name = 'id'>"; for ($i=0; $i < $num_results; $i++) { $row=mysqli_fetch_array($result); $id = $row["id"]; echo "<option value = "$id"> $id </option>"; } echo "<input type='submit' value='delete' />"; echo "</form>"; mysqli_close("$db"); ?> </body> </html> Quote Link to comment https://forums.phpfreaks.com/topic/201787-blank-page/ Share on other sites More sharing options...
bocasz Posted May 14, 2010 Share Posted May 14, 2010 there are a couple of error in the code you pasted echo "ID:" <select name = 'id'>"; for ($i=0; $i < $num_results; $i++) { $row=mysqli_fetch_array($result); $id = $row["id"]; echo "<option value = "$id"> $id </option>"; } echo "<input type='submit' value='delete' />"; echo "</form>"; should be echo "ID: <select name = 'id'>"; for ($i=0; $i < $num_results; $i++) { $row=mysqli_fetch_array($result); $id = $row["id"]; echo "<option value = ".$id."> ".$id." </option>"; } echo "<input type='submit' value='delete' />"; echo "</form>"; you have to pay attention to the strings Quote Link to comment https://forums.phpfreaks.com/topic/201787-blank-page/#findComment-1058456 Share on other sites More sharing options...
Maq Posted May 14, 2010 Share Posted May 14, 2010 A blank page usually indicates erroneously fatal errors in the PHP code. Putting these two lines directly after your opening <?php tag should output the error(s): ini_set ("display_errors", "1"); error_reporting(E_ALL); Quote Link to comment https://forums.phpfreaks.com/topic/201787-blank-page/#findComment-1058499 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.