Problem using a link to click a button...

A

Allyn

Here's the gist of my code:

<form name="myform" method="POST" action="somepage.php"
enctype="multipart/form-data">

<a href="javascript:myform.newimage.click();">(some text here)</a>
<input type="file" style="visibility:hidden;" name="newimage">

<textarea cols="60" rows="10" name="profile"></textarea>
<input type="submit" value="Change Profile" name="submit_people">
</form>


The two lines in the middle containing the link and the hidden file
input are doing something weird. When I click the link, it opens a
file browser and lets me choose a file. Then when I click the submit
button, nothing happens.

I tested the form again by making the file input visible and using it
directly, and it worked fine...submitting the file to the new page.
When I then tried using the link again, I was able to choose a file
successfully and the link appeared in the now visible file input area.
Then when I clicked the submit button I saw the path to the file i
selected get cleared and the page didn't go anywhere... I'm totally
stumped as to why this would happen. The idea behind my page is that
the link will be an image, and clicking it brings up the file input
browser to allow the user to selecte a new image to upload, replacing
the old one, like in a user's profile. Anyone know how to fix
this?...
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,079
Messages
2,570,574
Members
47,206
Latest member
Zenden

Latest Threads

Top