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 8094159
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T20:42:31+00:00 2026-06-05T20:42:31+00:00

I am trying to build a form in HTML that, once submitted, automatically generates

  • 0

I am trying to build a form in HTML that, once submitted, automatically generates a new webpage using data entered into the form.I’m usually a MATLAB and python user, so I tried them first. Matlab would parse the parse the data and save it to a new .txt file, but not a .html file. Python was much the same. After searching, I came across the suggestion to use PHP to create the new page from the form data. (Someone was using php to create user webpages with the users name, email, and a picture. I tried to adapt this to suit my needs, but it is not generating the new page as I thought it would. Instead, it just displays part of the PHP code. This is the form I made:

<form action="htmlData.php" method="post"> 

Product Name: 
<input name="Name" size="20" type="text">
<br><br>

Project Lead Name:
<input name="PLname" size="20" type="text"> <br><br>

Team-members: <br>
<textarea name="Team_members" rows=10 cols=40> </textarea> <br><br>

Product Type: <br>
<input name="Product_Type" size="20" type="text"> <br><br>

Description: <br>
<textarea name="Description" rows=10 cols=40 type="text"> </textarea>
<br>

<br> <br>



<input value="Submit" type="submit" name="formSubmit">
<input value="Reset" type="reset">
<input value="Help" type="button" onclick="window.location.href='problems.html'">
</form>

…And this is the PHP file named htmlData.php:

ob_start();  
$Name = $_POST['Name'];
$PLname= $_POST['PLname'];
$Team_members= $_POST['Team_members'];
$Product_type= $_POST['Product_type'];
$Description= $_POST['Description']; 
$html = <<<HEREDOC
     Product Name: $Name <br>
     Project Lead: $PLname <br>
     Team Members: $Team_members <br> <br>
     Product Type: $Product_type <br>
     Description: $Description
     HEREDOC;  
file_put_contents('newPage.htm', $html); 
header()redirect.header('location: newPage.html')

What do I need to change so that once a user clicks submit, a new page is generated from the data and the user is then taken to the newly created page? Is this possible with what I have, or should I looking into using a different language?

  • 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-05T20:42:32+00:00Added an answer on June 5, 2026 at 8:42 pm

    It’s possible with PHP and Python (perhaps MATLAB too).

    Given your PHP code, there are a few small issues. First, the HEREDOC must be ended at the beginning of the line (there can’t be any whitespace before the end HEREDOC).

    Second, the PHP code to redirect is invalid. Try these changes:

    <?php
    
    $Name = $_POST['Name'];
    $PLname= $_POST['PLname'];
    $Team_members= $_POST['Team_members'];
    $Product_type= $_POST['Product_type'];
    $Description= $_POST['Description'];
    
    $html = <<<HEREDOC
         Product Name: $Name <br>
         Project Lead: $PLname <br>
         Team Members: $Team_members <br> <br>
         Product Type: $Product_type <br>
         Description: $Description
    HEREDOC;  
    file_put_contents('newPage.htm', $html); 
    
    header('location: newPage.html');
    exit;
    

    The next issue you may encounter is that it cannot write to newPage.htm. You may need/want to specify a full path (e.g. /home/yoursite/public_html/files/newPage.htm).

    You will need to make sure that directory is writable by the web server (as often the web server runs as a different user than your files are owned by).

    Hope that helps.

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

Sidebar

Related Questions

I'm trying to build a simple HTML table form that displays values from a
I'm trying to build a simple HTML text editor in a Windows Form application.
I am trying to build a form with multiple autocompleted fields. I am using
Im trying to build a simple AJAX script that uses a form to send
Im trying to build a form that calculates a total price based on a
I'm trying to build a form using symfony2, but I keep getting the error
I'm trying to build a form that will list all users and allow you
I am trying to build a PHP Form with MySQL. The problem is that
I am trying to build Multipart Form Data directly in Javascript in order to
I'm new in asp.net mvc3 programming and I'm trying to build a specific form.

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.