Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8947339
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T12:44:01+00:00 2026-06-15T12:44:01+00:00

I created a form using html which contains a text box and a password

  • 0

I created a form using html which contains a text box and a password box.

I want when I click on the submit button to save the user and the date he entred to the page in a text file, then in the action page the txt file will be displayed and if there is a carriage return it will do the same in the action page.

this is the code I tried in the action page:

<?php

$mdpx = "BTS12";
$loginx = "BTS";

$login = $_POST['nom'];
$mdp = $_POST['psw'];
if(!empty($login) AND !empty($mdp))
{
    if($mdp  == $mdpx AND $login == $loginx)
    {
        $fichier = "monfichier.txt";
        $fp = fopen($fichier, "a+");
        flock($fp,LOCK_EX);
        $text .= 'Nom: '.$login."\r\n".'La date: '.date("d M Y : H i s",strtotime("now"))."\r\n".'****************************'."\r\n";
        fputs($fp, $text);
        flock($fp,LOCK_UN);
        fclose($fp);

        $fp = fopen($fichier,"r");
        flock($fp,LOCK_SH);
        while(!feof($fp))
        {
            $char = fgetc($fp);
            echo ($char == '\r\n') ? '<br/>' : $char;
        }
        flock($fp,LOCK_UN);
        fclose($fp);
    }
    else
        print 'Le nom d\'utilisateur ou bien le mot de passe est incorrect <br/> Cliquer <a href="index.php">ici</a> pour revounir a la page d\'acceuil';
}
else
    print 'Veuillez remplir tous les champs <br/> Cliquer <a href="index.php">ici</a> pour revounir a la page d\'acceuil';
?>

but the problem is that the action page doesn’t do the carriage return.

I tried also the method readfile() but it didn’t worked !

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T12:44:03+00:00Added an answer on June 15, 2026 at 12:44 pm

    Output the file in a <pre> element:

    echo '<pre>';
    readfile($fichier);
    echo '</pre>';
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've created my own theme using HTML, CSS, JS which contains FORM (Emp_ID,Emp_Name, Address
I have a simple ASP.Net MVC View which contains an FCKeditor text box (created
I'm trying to create an HTML form (using JSP) which contains Javascript buttons (rather
I want the user to enter the data in text field,which will be created
Having created dropdown lists using ViewBag which is working in an edit form. How
I've created my own signup form and creating the user using the Membership class.
Form contains two dropdown lists created using code below. Both dropdown list elements have
I am using JQuery and Jquery UI to create a dialog box which contains
I'm looking to create a form which contains a dynamic number of input text
I have a form in an MVC view which contains a number of text

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.