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

  • Home
  • SEARCH
  • 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 8623733
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T07:21:18+00:00 2026-06-12T07:21:18+00:00

How I can make PHP create a file for each order named whatever the

  • 0

How I can make PHP create a file for each order named whatever the person enters there name into the field

<?php

Name:           php echo $_POST["Firstname"]; 
            php echo $_POST["Lastname"];   <br /> <br />
Dorm Name:      php echo $_POST["DormName"];   <br />

Room Number:    php echo $_POST["RoomNumber"];   <br />

Pizza Type      php echo $_POST["PizzaType"];   <br />

?>

This is what i have so far but I need a function that will make a file for each submission and name it the persons name.

  • 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-12T07:21:19+00:00Added an answer on June 12, 2026 at 7:21 am

    your PHP should look something like this…

    <?php
    if ($_POST["submit"]) {
        $firstName = $_POST["firstName"];
        $lastName = $_POST["lastName"];
        $dormName = $_POST["dormName"];
        $roomNumber = $_POST["roomNumber"];
        $pizzaType = $_POST["pizzaName"];
    
        $fp = fopen($firstName . "_" . $lastName . ".txt", "a"); // the 'a' will append to the end of the file.
        fwrite($fp, "\n\n");
        fwrite($fp, "First Name: $firstName\n");
        fwrite($fp, "Last Name: $lastName\n");
        fwrite($fp, "Dorm Name: $dormName\n");
        fwrite($fp, "Room Number: $roomNumber\n");
        fwrite($fp, "Pizza Type: $pizzaType\n");
        fclose($fp);
    }
    ?>
    
    <html>
        <head>
            <title>test</title>
        </head>
        <body>
            <form method="POST" id="" action="">
                <input type="text" name="firstName" value="" />
                <input type="text" name="lastName" value="" />
                <input type="text" name="dormName" value="" />
                <input type="text" name="roomNumber" value="" />
                <input type="text" name="pizzaName" value="" />
                <input type="submit" name="submit" value="Submit" />
            </form>
        </body>
    </html>
    

    Note: If another person with the same name orders again, it will all just append to the bottom of the same file.

    Cheers

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

how to make php can read log file in /var/log/.... I tried this code
now I can make it work with user-profile.tpl.php page,all this page does is to
How can I make the deprecated functions to work in PHP's latest version? I
I would like to make a php script that can capture a page from
I can't make the following work. I know it's because of the PHP function
I'm a newbie in php programming and i can't make it finding where is
How can I make something like this below work? <?PHP $_SESSION['signup_errors']['test1']; $_SESSION['signup_errors']['test2']; $_SESSION['signup_errors']['test3']; $_SESSION['signup_errors']['test4'];
When using the function imagepng() in PHP, how can I make sure the images
Can someone tell/show me how to use PHP inside PHP. I'm trying to make
You can see my project here - http://www.inluxphoto.com/custom/jsgallery/index.php I am attempting to make the

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.