1

I have an issue when I clicked the button and submit the data from the form.it gets directly to the white screen and nothing happen I checked the database it does not add. it doesn't have error so its hard for me to figure out how to solve this

here is my code for index.php

<?php
require('./read.php');

?>

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>BASIC CRUD</title>
    <link rel="stylesheet" href="style.css">
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-EVSTQN3/azprG1Anm3QDgpJLIm9Nao0Yz1ztcQTwFspd3yD65VohhpuuCOmLASjC" crossorigin="anonymous">
</head>
<body>
    
    <section class="main container">
    <form class="create-main align-items-center mt-5 mb-5" action="/crud/create.php" method="post">
        <h1>Create User</h1>
        <input type="text" name="username" placeholder="Enter your username" required/>
        <input type="password" name="password" placeholder="Enter your password" required/>
        <input type="submit" name="create" value="CREATE">
    </form>

    <table class="table">
  <thead>
    <tr>
      <th scope="col">#</th>
      <th scope="col">First</th>
      <th scope="col">Last</th>
      <th scope="col">Handle</th>
      <th scope="col"></th>
      <th scope="col"></th>
    </tr>
  </thead>
  <tbody>
      <?php while($results = mysqli_fetch_array($sqlAccounts)) {?>
    <tr>
      <th scope="row"><?php echo $results ['id']?></th>
      <td><?php echo $results ['username']?></td>
      <td><?php echo $results ['password']?></td>
      <td>
          <form action="#" method="get">
          <input type="submit" name="edit" value="EDIT">
          </form>
      </td>
      <td>
          <form action="#" method="get">
          <input type="submit" name="delete" value="DELETE">
          </form>
      </td>
    </tr>
    <?php }; ?>
  </tbody>
</table>

    </section>

 <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/js/bootstrap.bundle.min.js" integrity="sha384-MrcW6ZMFYlzcLA8Nl+NtUVF0sA7MsXsP1UyJoMp4YLEuNSfAP+JcXn/tWtIaxVXM" crossorigin="anonymous"></script>
</body>
</html>
Ziggyboy
  • 13
  • 2
  • 1
    A white screen is usually an Internal Server Error. Check your server's error logs to see if there is any information there. – aynber Mar 29 '22 at 16:16
  • 1
    Does this answer your question? [Reference - What does this error mean in PHP?](https://stackoverflow.com/questions/12769982/reference-what-does-this-error-mean-in-php) - Linking this because the white screen error is literally the first in "The List" – Can O' Spam Mar 29 '22 at 16:22
  • The problem is in `create.php`. – Barmar Mar 29 '22 at 17:01
  • Please share what is contained in /crud/create.php. If the form submission is working correctly and it takes you to create.php, and that file does nothing, then you will have a blank screen. – CommonKnowledge Mar 29 '22 at 20:44
  • You can also run: `php -l file.php` on each file to check for syntax errors. – Paul T. Apr 01 '22 at 02:02

1 Answers1

0

You are very likely having a 500 error. Best if you go to your active php.ini file and find display_errors and make sure it's = On as in display_errors = On. Also check your error_log in your php.ini for the file that records your errors and you might want to check it out too. Looking at your code, errors can come from either not finding the included files, to what happens in /crud/create.php

Djongov
  • 195
  • 2
  • 13