Hi;
I am writing a submit form to let people to submit their information and upload a picture.
The problem for me is after i upload a picture, how i can let it display on the submit form,and also keep the values i just type for the fname and the age ?
Could anyone give me some idea, please. Thanks
submitform.php
<html>
<body>
<form action="process.php" method="post">
Name: <input type="text" name="fname" /><br>
Age: <input type="text" name="age" /><br>
a picture will display here after upload<br>
<a href="addpic.php">click here to add picture</a>
<input type="submit" name="submit" value="submit">
</form>
</body>
</html>
addpic.php
<form action="uploadpic.php method="post"
enctype="multipart/form-data">
<div>
<label for="file">picture:</label>
<input type="file" name="pic" id="pic">
<br>
<input type="submit" name="submit" value="submit">
</div>
</form>
uploadpic.php
<?php
if ($_FILES["file"]["error"] > 0)
{
echo "Error: " . $_FILES["file"]["error"] . "<br />";
}
else
{
echo "the file i uploaded is : " . $_FILES["file"]["name"] . "<br />";
}
?>
I am writing a submit form to let people to submit their information and upload a picture.
The problem for me is after i upload a picture, how i can let it display on the submit form,and also keep the values i just type for the fname and the age ?
Could anyone give me some idea, please. Thanks
submitform.php
<html>
<body>
<form action="process.php" method="post">
Name: <input type="text" name="fname" /><br>
Age: <input type="text" name="age" /><br>
a picture will display here after upload<br>
<a href="addpic.php">click here to add picture</a>
<input type="submit" name="submit" value="submit">
</form>
</body>
</html>
addpic.php
<form action="uploadpic.php method="post"
enctype="multipart/form-data">
<div>
<label for="file">picture:</label>
<input type="file" name="pic" id="pic">
<br>
<input type="submit" name="submit" value="submit">
</div>
</form>
uploadpic.php
<?php
if ($_FILES["file"]["error"] > 0)
{
echo "Error: " . $_FILES["file"]["error"] . "<br />";
}
else
{
echo "the file i uploaded is : " . $_FILES["file"]["name"] . "<br />";
}
?>