I'm a PHP newbie and trying to make a script for the last few days that is giving me a great headache ;-(
Currently I have an input.php page with a simple form (see input.php below).
Once the submit button is clicked it sends me over to output.php where it shows the input values embedded in html code (see output.php below).
What I'm hoping to accomplish is:
Once the input form is filled and the submit button is clicked it saves the entered values and embedded within the html code as a .txt file on my server (just like output.php below but with the actual values instead of echo) ... and next time I use input.php it updates/overwrites the .txt file with the new values embedded within the html code.
I've experimented with fwrite "w", but somehow I can't get it to work.
Also, if the input values can be saved straight to a .txt file and embedded within the html code, would I still need output.php?
Could someone please help me with this or point me in the right direction?
Thank you so much!!!
Current Input (input.php):
Code: Select all
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" >
<head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type" />
<title>Input Output Test File</title>
</head>
<body>
<h2>Data Input</h2>
<form action="output.php" method="post">
<input type="text" name="city" /> City<br />
<input type="text" name="col" /> Color<br />
<input type="text" name="pro" /> Product ID<br />
<input type="submit" />
</form>
</body>
</html>Code: Select all
<div class="fea">
<p><a href="http://www.domain.com/products.php?pro=<?php echo $_POST["pro"]; ?>">
<img src="http://www.domain.com/images/<?php echo $_POST["pro"]; ?>.jpg" height="75" width="100" /></a>
<strong>City: <?php echo $_POST["city"]; ?></strong><br />
Color: <?php echo $_POST["col"]; ?></p>
<p><a href="http://www.domain.com/products.php?pro=<?php echo $_POST["pro"]; ?>">Details</a></p>
</div>