Page 1 of 1
How to make connection to a DB throu login form?
Posted: Fri Nov 07, 2003 3:41 pm
by johnnyxp
cause i am new to PHP i need to give me some code that creats a fiels "username" and a field "password" then submits those entries to a page called e.g db.php and where the ......
Code: Select all
<?php
define("HOST", "localhost");
define("USER", "put the username var here from the field username");
define("PASS", "put the password here fro the field password");
define("DB", "HRC");
?>
plz i need a solution...i know you are fast Help me tnx!!!!
?>
Posted: Fri Nov 07, 2003 3:49 pm
by d3ad1ysp0rk
umm.. im not really sure what you mean.. but..
Code: Select all
<html>
<body>
<form action="db.php" method="post" name="form1">
Username: <input type="text" name="user"><br>
Password: <input type="text" name="pass"><br>
<input type="submit" name="submit" value="Login">
</form>
</body>
</html>
like that..?
Variables??
Posted: Fri Nov 07, 2003 4:49 pm
by johnnyxp
well my friend that is the form ok, but in the db.php file how to tell it that the username and password are comming from the form!???
i mean where is the Variables???

Posted: Fri Nov 07, 2003 4:53 pm
by qads
Code: Select all
<?php
$username = $_POST['username'];
$password = $_POST['password'];
?>
you mean this?
or do you mean you want to connect to a database useing ur defined vars?
Code: Select all
<?php
mysql_connection(HOST, USER, PASSWORD);
mysql_select_db(DB);
?>
Posted: Fri Nov 07, 2003 5:04 pm
by johnnyxp
i want to connect to the db by giving every time different usern & pass throught the form! i will taste your scode or do you have something ready?
Re: How to make connection to a DB throu login form?
Posted: Fri Nov 07, 2003 5:05 pm
by d3ad1ysp0rk
johnnyxp wrote:cause i am new to PHP
no offense, but that's a really bad reason.
[google]php tutorials[/google]
start there..
Posted: Fri Nov 07, 2003 5:08 pm
by johnnyxp
thats not a solution start reading tutorials and found my solution aftra hours when someone can give it to me in seconds, so that i will finish my homework in time, and then i will read the tutorial for better understanding!
Posted: Fri Nov 07, 2003 5:27 pm
by johnnyxp
any one?
Code: Select all
<?php
define("HOST", "localhost");
define("USER", "put the username var here from the field username");
define("PASS", "put the password here fro the field password");
define("DB", "HRC");
?>
Posted: Fri Nov 07, 2003 5:30 pm
by qads
you want to learn, we are happy to teach for free, you want to get code, we (most of us) charge by the hour.
Posted: Fri Nov 07, 2003 5:33 pm
by johnnyxp
plz people you were niewbies too!!! i thought that php follows the rule "human knowledge belongs to the world" and thats for FREE!!!
oh just forget it if you dont want to help.
tnx for your "free" time.
Posted: Fri Nov 07, 2003 5:33 pm
by d3ad1ysp0rk
do your homework tonight, read part of the tutorial tonight and part tommorow
and bam, you learnt how to do it on your own