Zubrag.com
September 17, 2019, 07:04:28 AM *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
 
   Home   Help Search Login Register  
Pages: 1 [2]
  Print  
Author Topic: How to Add to the signup form  (Read 24093 times)
Jonni
Newbie
*
Posts: 2


« Reply #14 on: November 05, 2008, 03:13:28 PM »

Hi,
Thanks Zubrag for the great script!
I ma having the same problem as above. I have followed the instructions in this topic and the problem I'm getting now is getting the data from the extra fields in the sign up form in the manager.php page! Only the original three columns, Login, Password and Email have what i entered on the sign up page in them the other 2 columns, First Name and Last Name, are blank. I am very new to php so know nothing about it other than little bits  i have learnt off various websites, mostly this one.
Any help would be appreciated as this is for my scout groups new website which i am developing in my free time around my A levels.

So here's my code.
user.def

Login,STRING,15
Password,STRING,15
Email,STRING,30
First Name,STRING,30
Surname,STRING,30
Redirect URL,STRING,40

signup_form.php

 <form method="post">
      <h3>User signup</h3>
      <font color="red"><?php echo $this->error; ?></font><br />
      Username:<br /><input type='input' name='access_login' value='<?php echo $this->login ?>'/><br />Password:<br />
      <input type="password" name="access_password" />
  <?php if (USE_EMAIL && !LOGIN_AS_EMAIL) echo "<br />Email:<br /><input type='input' name='access_email' value='$this->email' />"; ?>
      <br>
         First Name:<br />
        <input type='input' name='FirName' value='<?php echo $this->FirName ?>' />
        <br />
         Last Name:<br />
        <input type='input' name='LasName'value='<?php echo $this->LasName ?>' />
        <br />
<input type="submit" name="access_submit" value="Sign up" />
    </form>

signup.php

  function parse_user_input() {
    $this->login = isset($_POST['access_login']) ? $_POST['access_login'] : '';
    $this->pass = $_POST['access_password'];
    $this->email = LOGIN_AS_EMAIL
                 ? $this->login
                 : (isset($_POST['access_email']) ? $_POST['access_email'] : '');
   $this->FirName = $_POST['first_name'];
   $this->LasName = $_POST['last_name'];

 function save_user() {
    // save user to database
    $fusers = fopen(USERS_LIST_FILE,'a+');
    if (!$fusers) {
      $this->error = "Cannot add user to database.";
      return false;
    }
    fputs($fusers, "\n" . $this->login. ',' . $this->pass . ',' . $this->email . ',' . $this->FirName . ',' . $this->LasName);
    fclose($fusers);
  }

Thanks,
Jonni

Logged
Pages: 1 [2]
  Print  
 
Jump to:  

Powered by SMF 1.1.11 | SMF © 2006-2009, Simple Machines LLC