Jump to content

Syntax help, button position


rollerboy

Recommended Posts

Hi,I have a script that validates if a users password is correct. If the password is correct I want to add a button for the user to continue. The script below displays the button if the user is valid or not. When I move the button code to after the line (echo "Welcome back $Username";) I get a parse error. I have also tried to echo out the button like the first 4 lines below but this doesnt work either. Any ideas?? Also what is the simplest way to set a cookie?

echo "<form action= "login_display.php" method="post">";
echo "<input type="submit" value="Continue">";
echo "<input type=\"hidden\" name =\"Username\" value=$Username>";
echo "</form>";

//Password Validate
<?php
include ("customers_inc.php");

$query= "SELECT Password FROM customer_details WHERE Username='$Username'";
$result=mysql_query($query);
$num=mysql_num_rows($result);

if ($num ==0)
{
echo "The database contains no contacts yet";
}
else
{
echo "<b><centre> Contacts</centre></b><br><br>";
?>


<?
$i=0;
while ($i<$num)
{
$db_Password=mysql_result($result, $i, "Password");
?>


<?
$i++;
}
//60
echo "</table>";
}
?>
<?
if (($db_Password)===($Password))
{
echo "Welcome back $Username";
}
else
{
echo "<b><centre> Invalid user</centre></b><br><br>";
echo "Please try again <a href=\"index2.php\"> Insert details</a><br>";
}
?>
<form action= "login_display.php" method="post">
<input type="submit" value="Continue">
<? echo "<input type=\"hidden\" name =\"Username\" value=$Username>"; ?>
</form>


Thanks in advance for any help
Link to comment
Share on other sites

Try this and see if it works:

[code]

//top part cut off for easy reading

if (($db_Password)===($Password))
{
echo "Welcome back $Username";
echo"<br><br><form action= 'login_display.php' method='post'>
<input type='submit' value='Continue'>
<input type='hidden' name ='Username' value=$Username>
</form>";
?>
}
else
{
echo "<b><centre> Invalid user</centre></b><br><br>";
echo "Please try again <a href=\"index2.php\"> Insert details</a><br>";
}
?>
[/code]
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.