Hi i need to create a form in a .html file myteamform.html, then take the data entered into the form and process it in a .php file "roster.php" which takes the data and adds it another.html page team_roster.html. I have my form done, my problem is how do you add the data to the second .html page through the .php file. Right now i have my php writing the data to a file, but i can't read the data from the file unless my team_roster.html page is .php. Basically what i need help with is how to the form data through the .php file and output from another .html file.

1) you can't
2) You need to setup $_POST (or $_GET, depending on the method you use) variables to receive the form data, then have it connect/insert the data into a mysql database, and then put a while loop in your team_roster.php page that selects all the rows from the team table.

If any of this sounds confusing, consult www.w3schools.org and read up on PHP.

Member Avatar for diafol

You can alter your .htccess file to allow php within .html files.

Add this to it:

AddType application/x-httpd-php .html .htm

Alternatively, rename the html file to php

you can add data to another page of your html either by

$_POST['variab1e_value']

or

$_GET['varible_value']

method depending on your form.
e.g
oh your HTML code

<form action="form_action.asp" method="get">
  First name: <input type="text" name="fname" /><br />
  Last name: <input type="text" name="lname" /><br />
  <input type="submit" value="Submit" />
</form>

the method of the form here is GET, therefore your php code for get method is

<?php echo $_GET["fname"] ."<br />".$_GET["lname"]; ?>
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.