0

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.

4
Contributors
3
Replies
5
Views
6 Years
Discussion Span
Last Post by decade
0

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.

1

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

0

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"]; ?>
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.