Jump to content

[SOLVED] Form Problem, need debugging tips


atticus

Recommended Posts

The page is blank.  It is called to edit info in database.  The form is not showing up at all.  When I enter text before the first IF statement it does show up.

 

When I echo in the elseiff section, I still get a blank page. 

 

When I echo "(" .$result.")";

I get a blank, not even any paranthesis

 

<?php
session_start();

// is the one accessing this page logged in or not?
if (!isset($_SESSION['db_is_logged_in']) 
   || $_SESSION['db_is_logged_in'] !== true) {

   // not logged in, move to login page
   header('Location: login.php');
   exit;
}
?>
<html>
<body>
<?php
include("config.php");
  if(isset($_POST['submit']))

  {
      $name = mysql_escape_string($_POST['name']);
      $password = mysql_escape_string($_POST['password']);
         $result = mysql_query("UPDATE cust SET cust_id='$name', cust_password='$password' WHERE cust_id ") or die('Error, query failed : ' . mysql_error());
          echo "<b>Thank you! User UPDATED Successfully!<br />You will be redirected in 4 seconds";
          echo "<meta http-equiv=Refresh content=4;url=index.php>";
}
elseif(isset($_GET['cust_id']))
{ 
        $result = mysql_query("SELECT * FROM cust WHERE cust_id='$_GET[cust_id]' ") or die('Error, query failed : ' . mysql_error()); 
        while($myrow = mysql_fetch_assoc($result)) 
             {
                $name = $myrow['cust_id']; 
                $password = $myrow['cust_password'];
             
?>
<br>
<h3>::Edit User</h3>
<form method="post" action="<?php echo $PHP_SELF ?>">
Name: <input name="title" size="40" id="title" maxlength="255" value="<? echo $name; ?>">
<br>
Password: <textarea name="description"  id="description" rows="7" cols="30"><? echo $password; ?></textarea>
<br>
<input type="submit" name="submit" value="Update">
</form>"
<?php
              }//end of while loop
  }//end else
?>
</body>
</html>

 

Link to comment
https://forums.phpfreaks.com/topic/77316-solved-form-problem-need-debugging-tips/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.