SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Member
    Join Date
    Jan 2013
    Posts
    1
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Need some quick help with PHP form

    I'm working with a client and setting up this form for them. I'm trying to have the user be able to add a new name and email record into the account table. Once they submit it should display the 10 newest records below the form. Appreciate any help.


    class account{
    function account(){
    $this->id = ' ';
    $this->name = '';
    $this->email = '';
    }
    function find_account($id){
    $sql="select `id` from `account` where `id`='".$id."'";
    $result = mysql_query($sql);
    while ($row = mysql_fetch_assoc($result)){
    $row['id']; //int pk auto incerment
    $row['name']; //varchar(50)
    $row['email']; //varchar(50)
    $row['timestamp']; //varchar(15)
    }
    }
    }
    <html>
    <body>
    <div>
    <form action='#'>
    name: <input type='text' name='account_name'>
    emailinput type='text' id='account_email'>
    <input type="button" value="submit">
    </form>
    </div>
    <div style="border:solid 1px #F60;">
    Last 10 entry:
    </div>
    <div style="border:solid 1px #000;">
    <?php echo "id: ".$account->id;?>
    <?php echo "name: ".$account->name;?>
    <?php echo "email: ".$account->email;?>
    </div>
    </body>
    </html>

  2. #2
    Keeper of the SFL StarLion's Avatar
    Join Date
    Feb 2006
    Location
    Atlanta, GA, USA
    Posts
    3,748
    Mentioned
    73 Post(s)
    Tagged
    0 Thread(s)
    Well, you need to specify a method to that form... and implement some sort of logic for INSERT'ing the data into the table, and then either move your function code out of the function and down below the form, or have it create an array of objects that it passes out which you then loop through....
    Never grow up. The instant you do, you lose all ability to imagine great things, for fear of reality crashing in.


Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •