Re: Using $_POST with Submit button

From: steve (UseLinkToEmail_at_dbForumz.com)
Date: 08/15/04

  • Next message: C.J. Garibay: "Re: When a field value is empty how do you not show it..."
    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
    

  • Next message: C.J. Garibay: "Re: When a field value is empty how do you not show it..."

    Relevant Pages

    • Comparison Script Components with Script Classes
      ... Now I would like to have some advice from more experienced programmers. ... I do not really figure out, how the concepts of Script Components and Script Classes differ and for what use cases they are intended. ... How do you build your strictly object-oriented libraries in VBScript? ...
      (microsoft.public.scripting.vbscript)
    • Re: Re: Stop PHP utterly!
      ... > I’m using windows and I did try to kill the process with task ... Are you sure you don’t have a statement in your script that disables ... Visit Topic URL to contact author (reg. ...
      (comp.lang.php)
    • Re: aborting a bash script with control-c
      ... You get advice for free, ... where we invoke system- running a very short execution time ... script - for every line in the input. ...
      (comp.unix.shell)
    • Re: Dynamic Disk Help ?
      ... I can boot from a floppy or CD ... If I try to re-install Windows or I try to repair the existing ... > cannot get into recovery console so I would welcome some advice please ... > Visit Topic URL to contact author (reg. ...
      (microsoft.public.windowsxp.help_and_support)
    • Re: ksh: Copying files one by one
      ... Thanks for misc. ... I first implemented using Bill's advice, ... advice by Markus and Chris. ... Even though my script is still a bit buggy, ...
      (comp.unix.shell)