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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.