Jump to content

Same Page Form Submission Help


davelearning
 Share

Recommended Posts

Hi all,

 

I am wondering if nayone can spot why more form is not processing, basically the page just loads afresh once details have been entered and submit button clicked

 

The page is called client.php

<?php
session_start();

if (isset($_POST['submit']))
{
include('config.php');
$username = $_POST['username'];
$password = md5($_POST['password']);
$query = mysql_query("SELECT email,password FROM customers WHERE email='$username' AND password = '$password'");
$count=mysql_num_rows($query);


	if($count==1)
		{
			$query1= mysql_query("SELECT id FROM customers WHERE email='$username'");
			echo mysql_error() ;
			while($row = mysql_fetch_assoc($query1))
  				{
					$id = $row['id'];
					$_SESSION['id'] = $id;
					$_SESSION['logged'] = "SET";
					header("Location: client.php?id=$id");
				}
		}

	else
		{
			echo "<script>alert('Incorrect Login Details')</script>";
		}
}
?>

<link href="styles/style.css" rel="stylesheet" type="text/css" />
<link href="styles/form_clean.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="scripts/pageload.js"></script>
<script type="text/javascript">
function swapImages(that) {
  that.src =  (that.src.indexOf('buttonselected')>-1) ? ("images/"+that.id+"button.gif") : ("images/"+that.id+"buttonselected.gif");
}
</script>
<link href="styles/form_clean.css" rel="stylesheet" type="text/css" />

</head>

<body>

<div id="main">
<div id="links">
	<a href="index.php"><img src="images/homebutton.gif" alt="Home Button" class="buttons" id="home" onmouseover="swapImages(this)" onmouseout="swapImages(this)" /></a>
	<a href="javascript:ajaxpage('packages.php', 'content');"><img src="images/packagebutton.gif" alt="Packages Button" class="buttons" id="package" onmouseover="swapImages(this)" onmouseout="swapImages(this)" /></a>
<a href="javascript:ajaxpage('purchase.php', 'content');"><img src="images/purchasebutton.gif" alt="Purchase Button" class="buttons" id="purchase" onmouseover="swapImages(this)" onmouseout="swapImages(this)" /></a>
<a href="javascript:ajaxpage('contact.php', 'content');"><img src="images/contactabutton.gif" alt="Contact Button" class="buttons" id="contacta" onmouseover="swapImages(this)" onmouseout="swapImages(this)" /></a>
          <a href="client.php"><img src="images/clientbutton.gif" alt="Client Button" class="buttons" id="client" onmouseover="swapImages(this)" onmouseout="swapImages(this)" /></a>
</div>
    
    
    <div id="logobox"><img src="images/logo.png" alt="JollyHosting.com - Simplified Reseller Hosting"/>
</div>
    <div id="content">
    <img src="images/gaptop.png" alt="seperator" />
    
    <?php

if(!isset($_SESSION['logged']))
{
	?>
       <h2> Please Login</h2>
        <div id="login">
    <form class="clean" action="client.php" method="post">
      <ol>
        <li>
          <fieldset>
            <legend>Login</legend>
            <ol>
              <li>
                <label for="username">Email Address</label>
                <input type="text" id="username" name="username" value="" />
              </li>
              <li>
                <label for="password">Password</label>
                <input type="password" id="password" name="password" value="" />
              </li>
            </ol>
          </fieldset>
        </li>
      </ol>
      <p style="text-align:right;">
        
        <input type="submit" value="OK" />
      </p>
    </form>
    </div>
	<?php
}

else
{
	echo "loggin in";
}
    ?>
  </div>
    
    <?php include('footer.php');?>
</div>
</body>
</html>

 

 

Many thanks

 

Link to comment
Share on other sites

$_POST['submit'] refers to the name of a submit button. your submit button doesnt have a name.

 

change:

[color=rgb(0, 0, 0)]<input type="submit" value="OK" />[/color]

 

to:

[color=rgb(0, 0, 0)]<input type="submit" name="submit" value="OK" />[/color]

 

Link to comment
Share on other sites

This thread is more than a year old.

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.

 Share

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