Jump to content

Holding photo input in form


dc_jt

Recommended Posts

Hi

I have a form which contains fields such as name, email, photo etc.

If someone does not enter a required field such as a name or email then they are returned back to the form with the error messages displayed.

When the form is refreshed, every input they entered is still there by using [quote]<H4><input name="email" type="text" value="<?=htmlentities(stripslashes($_POST['email']))?>" SIZE=50/>[/quote] for example.

The only one that doesnt is the photo field. Any idea how to keep hold of the photo input field when the form is refreshed?

Below is the code for my form

Thanks

[quote]<form enctype="multipart/form-data" action="<?=$_SERVER['PHP_SELF']?>" method="post">
</center><BLOCKQUOTE><center><P><TABLE BORDER=0 CELLSPACING=0>
<TR>
<TD WIDTH=116>
<H4>Name:</H4>
</TD><TD>
<H4><input name="name" type="text" value="<?=htmlentities(stripslashes($_POST['name']))?>" SIZE=50/>
<br class="clear"/></H4>
</TD></TR>
<TR>
<TD WIDTH=116>
<H4>Address:</H4>
</TD><TD>
<H4><input name="address1" type="text" value="<?=htmlentities(stripslashes($_POST['address1']))?>" SIZE=50/>
<br class="clear"/>
</TD></TR>
<TR>
<TD WIDTH=116>
<H4>Town:</H4>
</TD><TD>
<H4><input name="town" type="text" value="<?=htmlentities(stripslashes($_POST['town']))?>" SIZE=50/>
<br class="clear"/>
</TD></TR>
<TR>
<TD WIDTH=116>
<H4>City:</H4>
</TD><TD>
<H4><input name="city" type="text" value="<?=htmlentities(stripslashes($_POST['city']))?>" SIZE=50/>
<br class="clear"/>
</TD></TR>
<TR>
<TD WIDTH=116>
<H4>Post Code/Zip Code:</H4>
</TD><TD>
<H4><input name="postcode" type="text" value="<?=htmlentities(stripslashes($_POST['postcode']))?>"/></H4>
<br class="clear"/>
</TD></TR>
<TR>
<TD WIDTH=116>
<H4>Country:</H4>
</TD><TD>
<H4>
<select name="country">
        <option value="United Kingdom">United Kingdom</option>
        <option value="United States of America">United States of America</option>
        <option value="Spain">Spain</option>
        <option value="Italy">Italy</option>
      </select>
<TR>
<TD WIDTH=116>
<H4>Email Address:</H4>
</TD><TD>
<H4><input name="email" type="text" value="<?=htmlentities(stripslashes($_POST['email']))?>" SIZE=50/>
<br class="clear"/></H4>
</TD></TR>
<TR>
<TD WIDTH=210>
<H4>I agree to grant a license for you to use my text/photograph</H4>
</TD><TD>
<H4><input name="license" type="checkbox" id="license" value="1" <?=($_POST['license'] == '1')?' checked="checked"':''?>/></H4>
<TR>
<TD WIDTH=116>
<H4>Photo:</H4>
</TD><TD>
<H4><input type="file" name="photo" ></H4>
<br class="clear"/></H4>
</TD></TR>
<TR>
<TD WIDTH=116>
<H4>Memory:</H4>
</TD><TD>
<H4><textarea name="memory" rows=6 cols=40 id="memory"><?=($_POST['memory'])?></textarea></textarea></H4>
</TD></TR>
<TR>
<TD WIDTH=210>
<H4>Data Protection:</H4>
</TD><TD>
<H4><input name="datap" type="checkbox" id="datap" value="1" <?=($_POST['datap'] == '1')?' checked="checked"':''?>/></H4>


<br class="clear"/>
<input type="Submit" name="submit" value="Submit"  class="button"/>
  <input type="hidden" name="mode" value="apply" />
<?php }//end else?>[/quote]
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.