F1Fan Posted October 13, 2008 Share Posted October 13, 2008 This will add the entered data into the fields if something was entered before. Also, you were only closing the input fields with > in your IF statement. <p>From name: <input type="text" name="fromname" value="<?php echo @$_POST['fromname']; ?>"><?php if (isset($missing) && in_array('fromname', $missing)) { ?><p>Please enter your name</p><?php } ?> <p>From e-mail: <input type="text" name="fromemail" value="<?php echo @$_POST['fromemail']; ?>"><?php if (isset($missing) && in_array('fromemail', $missing)) { ?><p>Please enter your email</p><?php } ?> Quote Link to comment Share on other sites More sharing options...
mallen Posted October 14, 2008 Author Share Posted October 14, 2008 Thanks F1FAN. I had this before I saw your post. It works but doesn't remember the "filename" field. <p>Send an e-mail with an attachment:</p> <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post" enctype="multipart/form-data" name="form1"> <p>From name: <input type="text" name="fromname" <?php if (isset($missing)) { echo 'value="'.htmlentities($_POST['fromname']).'"';} ?> <p>From e-mail: <input type="text" name="fromemail" <?php if (isset($missing)) { echo 'value="'.htmlentities($_POST['fromemail']).'"';} ?> <p>File: <input type="file" name="filename" <?php if (isset($missing)) { echo 'value="'.htmlentities($_POST['filename']).'"';} ?> <p><input type="submit" name="Submit" value="Submit"> Quote Link to comment Share on other sites More sharing options...
F1Fan Posted October 14, 2008 Share Posted October 14, 2008 Yes, you cannot assign a value to a file type input. This could be a big security problem if you could. For example, you would be able to assign a value (possibly a file on the user's computer) and hide it from the user. Then if the user posted a form, they could be uploading a file without knowing it. Quote Link to comment Share on other sites More sharing options...
mallen Posted October 15, 2008 Author Share Posted October 15, 2008 Thanks I am going to close this thread and start a new one. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.