Re: Using $_POST with Submit button
From: steve (UseLinkToEmail_at_dbForumz.com)
Date: 08/15/04
- Previous message: Gustaf Liljegren: "Re: setlocale() has no effect"
- In reply to: Antoni: "Using $_POST with Submit button"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: 14 Aug 2004 20:17:11 -0400
"Antoni" wrote:
> Hello,
>
> I wondered if anyone could further advice? In my script I was
trying
> allow the user to enter a userid and password, and when the users
> clicks the login button. Pass these values passed to a method
> login_user, and finally display there record.
>
> I was hoping to display the record on this page. I would appreicate
> some advice if my scrips looks corrects? I unsure about the line
> if(isset($_POST[’login’])){?
>
> Thank you
>
> <?php
> function login_form(){
> ?>
> <html>
> <head>
> <title></title>
> </head>
>
> <body>
>
> <div align="center">
> <form method="post">
> <table border="1">
> <tr>
> <th align="right">E-mail</th>
> <td nowrap>
> <input name="userid" size="25">
> </td>
> </tr>
> <tr>
> <th align="right">Password</th>
> <td nowrap>
> <input name="password" size="25">
> </td>
> </tr>
> <tr>
> <td align="center">
> <input type="submit" name="login"
value="Login">
> </td>
> </tr>
> </table>
> </form>
> <div>
> <?php
> }
>
> login_form();
>
> if(isset($_POST[’login’])){
> $userid = $_POST["userid"];
> $password = $_POST["password"];
> $userRecord = login_user($userid, $password);
> displayRecord($userRecord);
>
> echo "</body>";
> echo "</html>";
> }
> ?>
>
> </body>
> </html>
I did not go thru the code fully, so I leave that to others to comment
on.
(isset($_POST[’login’]))... refers to detecting that the form has been
submitted. The value of $_POST[’login’] would be set when the submit
button has been pressed. As your form and your form-processing logic
are both on the same script, this is the way of detecting when $_POST
values are present for processing
-- http://www.dbForumz.com/ This article was posted by author's request Articles individually checked for conformance to usenet standards Topic URL: http://www.dbForumz.com/PHP-_POST-Submit-button-ftopict139727.html Visit Topic URL to contact author (reg. req'd). Report abuse: http://www.dbForumz.com/eform.php?p=467354
- Previous message: Gustaf Liljegren: "Re: setlocale() has no effect"
- In reply to: Antoni: "Using $_POST with Submit button"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|