Jump to content

Archived

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

perezf

help with simple php

Recommended Posts

:-\
what is wrong with the following code
i am getting an  error
[quote]Parse error: parse error, unexpected T_BOOLEAN_AND in /hsphere/local/home/way2fr3s/2fr3sh.com/userlogin.php on line 15[/quote]
[code]<?php
$username = "admin";
$password = "password";

$user = $_POST['user'];
$pass = $_POST['pass'];

if($user == $username) && if($pass == $password) {//line 15
echo "Welcome to our site $user.";
} else { ?>
<form name="form1" method="post" action="">
  <p>
    UserName:<br>
    <input type="text" name="user">
    <br>
  Password:<br>
  <input type="text" name="pass">
  <br>
  <input type="submit" name="Submit" value="Submit">
</p>
</form><?php } ?>[/code]

Share this post


Link to post
Share on other sites
try this

[code=php:0]
if ($user == $username && $pass == $password) {
[/code]

Hope this helps,
Tom

Share this post


Link to post
Share on other sites
if($user == $username) && if($pass == $password)
using $$ for not tie two if statment by using for tie its contents

if ($user == $username && $pass == $password)

Share this post


Link to post
Share on other sites
i could i read the username and password from a database

Share this post


Link to post
Share on other sites

×

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.