php - How to autosubmit data html form? - Stack Overflow

I have this simple form:<form ENCTYPE="multipartform-data" action="story.php" m

I have this simple form:

<form ENCTYPE="multipart/form-data" action="story.php" method="POST">
<input type="submit" value="Show files">
<input type="hidden" name="emailp" id="emailp" value="">
</form>

I fill the "value" with a querystring parameter by external iframe and javascript. Ok. Now I need to send this data to a php file. My idea was go for autosubmit. Now I can do that with a button like "show files", but I dont need a button but something that send the value automatically. Is it possible do that?

I have this simple form:

<form ENCTYPE="multipart/form-data" action="story.php" method="POST">
<input type="submit" value="Show files">
<input type="hidden" name="emailp" id="emailp" value="">
</form>

I fill the "value" with a querystring parameter by external iframe and javascript. Ok. Now I need to send this data to a php file. My idea was go for autosubmit. Now I can do that with a button like "show files", but I dont need a button but something that send the value automatically. Is it possible do that?

Share Improve this question asked Jul 9, 2012 at 14:52 user840718user840718 1,6117 gold badges36 silver badges61 bronze badges 1
  • possible duplicate of Javascript autosubmit form – Oleg V. Volkov Commented Jul 9, 2012 at 14:59
Add a ment  | 

2 Answers 2

Reset to default 4

Call a this JS code that submits the form after you set the value of the input.

document.getElementById("storyForm").submit();

HTML:

<form ENCTYPE="multipart/form-data" action="story.php" method="POST" id="storyForm">
<input type="submit" value="Show files">
<input type="hidden" name="emailp" id="emailp" value="">
</form>

If you add an ID to that form you could do it like this .

$('#FORM_ID').submit(); with jQuery

form = document.getElementById('FORM_ID');
   form.submit();

or with JavaScript

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745304548a4621632.html

相关推荐

  • php - How to autosubmit data html form? - Stack Overflow

    I have this simple form:<form ENCTYPE="multipartform-data" action="story.php" m

    1小时前
    20

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信