how to get values from $_Post with onchange="form.submit();"?


Posted on 16th Feb 2014 07:03 pm by admin

Hi, I have a form that submit to itself with a file upload field and two other hidden field values.
If I put a submit button on the page, all is working fine.

I don't like the submit button as its wasting space. So I want to use
Code: <input size="10" type="file" name="img1" onchange="image.submit();">
If I add Code: print_r($_FILES); I do get the array but the
Code: if(isset($_POST['submit'])){}does nothing...

My form is as follow.....
Code: <form method="POST" name="image" action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post" enctype="multipart/form-data" >
<table>
<input id="ad" name="ad" value="<?php echo $adnr;?>" type="hidden"/>
<input id="user" name="user" value="<?php echo $user;?>" type="hidden" />
<tr><td><input size="10" type="file" name="img1" onchange="image.submit();"></td></tr>
<tr><td><input type="submit" name="upload" value="Upload"></td></tr>
</table>

</form>

No comments posted yet

Your Answer:

Login to answer
130 Like 7 Dislike
Previous forums Next forums
Other forums

convert PHP array to Javascript array
I have a page that gets a request sent from AJAX, and I am trying to convert a PHP array to a javasc

help with database debug pls
Parse error: syntax error, unexpected T_ELSE in /home/content/m/e/s/mesick/html/students/05/php/chec

recrawling
Can anyone suggest me how may i know a page is updated before it is being downloaded, so that i can

show random images
hey guys

can someone please suggest a way in which the following code can be edited so it onl

How to return to a previous page after running a PHP script
I'm having a bit of a melt down here because I think this should be really easy but can't work it ou

Multiple if statements
Ok so seems basic but for some reason I'm not doing it right. What I want is to be able to have 2 se

IS Retail & Manufacturing
Hi

Can IS Retail and Manufacturing activities be done in same instance ie. in same client

Something like an INI editor or a DelimitedText-Editor
Hi all,

Am very, very, very new to PHP and not sure if I should be posting this to a Javascri

random generation
hi

i need help with generating this

numbers from 1-12

i want to generate in ran

Passing vars to the DB
I have 3 small testing tables:

ID TYPE
1 pepperoni
2 C. bacon
3 taco

ID TY

Sign up to write
Sign up now if you have flare of writing..
Login   |   Register
Follow Us
Indyaspeak @ Facebook Indyaspeak @ Twitter Indyaspeak @ Pinterest RSS



Play Free Quiz and Win Cash