Send form with Input Hidden automatically after being filled in

Asked

Viewed 155 times

0

I need to send this form without any action, only when the Hidden input is filled in. No button, no action, just send...

I know there are questions like: "How to send a form automatically when inputs are completed?" that serve me 70% because, there he adds manually the values and then triggers the function. But when I have automatic filling of Hidden inputs it does not recognize and does not send. Follow the code..

<form method="post" action="action.php">
                    <div class="form-row" >                                                              
                             <input name="nome" type="hidden" value="$var">                                                        
                    </div>                                              
                    <button type="submit" class="btn btn-primary">Calcular</button>
                </form>

I want this code to send automatically in the processing of the page, without visual or mechanical interference. would have as?

variables receive values in page processing.

  • I couldn’t quite understand what you want to do. Could you clarify a little more your question?

  • Did you try to input the value? Example: <input name="nome" type="hidden" value="<?php echo $var" ?>

  • Hello, yes it is worth everything just need it send without me doing any action, I will edit some things in the topic

1 answer

1

The only way I imagine in this situation is by placing a jQuery, and you already fill in the fields by php.

$(window).load( function(){ $('.btn').trigger('click'); });

Oh but one of his own $('form').submit() at the end of the page.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.