Jump to content

Selfsubmit form problem


Peuplarchie

Recommended Posts

Good day to you all,

          I'm working on a php text based login script.

          I'm at building the script to add, delete or edit account.

 

          Here my problem :

When I enter a name password, it add it twice to the txt file.

Also, it oly add the ame of the field and not it value.

     

 

Here's my code :

 

<?php


$username = $_POST['username'];
$password = $_POST['password'];
$url = $_POST['url'];

function add_user($user,$url,$pass)
{
    $fopen = fopen('info.text', 'a');
    fwrite($fopen, "\n,'".$user."' => '".$url."' => '".$pass."'");
    fclose($fopen);
}

add_user('username','password','url');
?> 


<html>
   <body>
      <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post">
     <input type="text" name="username" />
     <input type="text" name="password" />
         <select name="url">
            <option value="Director/index.php">Director</option>
            <option value="Admin/index.php">Admin</option>
            <option value="User/index.php">User</option></select><br />

         <input type="submit" /><br />


      </form>
  
  
      Preview:<br />
      <?php if(isset($_POST['html'])) echo stripslashes($_POST['html']); ?>
  
  
  
  
   </body>
</html>

 

 

 

Thanks !

Take care !

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.