logo
Apache Lounge
Webmasters

 

About Forum Index Downloads Search Register Log in RSS X


Keep Server Online

If you find the Apache Lounge, the downloads and overall help useful, please express your satisfaction with a donation.

or

Bitcoin

A donation makes a contribution towards the costs, the time and effort that's going in this site and building.

Thank You! Steffen

Your donations will help to keep this site alive and well, and continuing building binaries. Apache Lounge is not sponsored.
Post new topic   Forum Index -> Coding & Scripting Corner View previous topic :: View next topic
Reply to topic   Topic: Not Passing data between pages using post (using PHP)
Author
pedro2k



Joined: 17 Jun 2006
Posts: 16

PostPosted: Thu 27 Jul '06 22:11    Post subject: Not Passing data between pages using post (using PHP) Reply with quote

Hi,
I am trying to learn PHP and at every turn something does work right!!!
So I need some help!!!!

Right the php page called login uses forms and the POST command (code below)

<form meth="POST" action="movie1.php">
<p> Enter your username:
<input type="text" name="user">
</p>
<p> Enter your password:
<input type="password" name="pass">
</p>
<p>
<input type="submit" name"submit" value="Submit">
</p>
</form>


and the page it moves to has the code below, but it always moves to the else command. The other thing i have noticed is that the information is in the url http://pedro-serve/test/movie1.php?user=Joe&pass=12345&=Submit
Is this right?


session_start();
$_SESSION['username'] = $_POST['user'];
$_SESSION['userpass'] = $_POST['pass'];
$_SESSION['authuser'] = 0;

//Check username and password information
if (($_SESSION['username'] == 'Joe') and
($_SESSION['userpass'] == '12345')) {
$_SESSION['authuser'] = 1;
} else {
echo "Sorry, but you don't have permission to view this page, you loser!";
exit();
}


Is there something in the httpd.conf or php.ini files that i need to change to get this working??

Thanks

PEDRO
Back to top
James Blond
Moderator


Joined: 19 Jan 2006
Posts: 7371
Location: Germany, Next to Hamburg

PostPosted: Thu 27 Jul '06 22:28    Post subject: Reply with quote

Your problem is <form meth="POST" action="movie1.php">
that should be correct <form method="POST" action="movie1.php"> and then in the url shouldn't parameter with ? and & and & Wink
Parameters in the url is allways GET.
That missspelling made the error. the rest is correct. But you don't need to set a session. If there isn't another page, where you need the data.
Back to top
pedro2k



Joined: 17 Jun 2006
Posts: 16

PostPosted: Thu 27 Jul '06 22:38    Post subject: Reply with quote

Thank you!!!
Right back on with the book!

Pedro2k
Back to top


Reply to topic   Topic: Not Passing data between pages using post (using PHP) View previous topic :: View next topic
Post new topic   Forum Index -> Coding & Scripting Corner