Pass information to a Form Submit

Asked

Viewed 168 times

2

I had asked a poorly elaborated question. I would like to pass an information by a form Ubmit, that information would be standard for example:

Password = 123

This information would not appear to the user would be transmitted in background for me to make a post.

I have some inputs, for example:

<div class="row" style="border:none!important;">
    <div class="form-group col-sm-6 col-xs-6 inline-input">
        <div class="input-group col-sm-12 col-xs-12">
            <div class="input-group-addon"><span class="elegant icon_phone"></span></div>
            <input type="text" class="form-control mask-phone" id="telefone-cadastro" name="telefone" placeholder="Telefone" required>
        </div>
    </div>
</div>

What I need is to pass a report as if it were an input but I would already set the value it was would have at the time of Submit.

  • Want to set in browser or set in server side?

  • From what I realized "would be transmitted in the background for me to make a post" should be in the right form?

  • Because if you want to set on the server the best would be to use a Session, because in the browser can be manipulated.

  • It is true, if it is necessary to have some security in this operation should save the value also on the server side and do the check when sending the data

1 answer

5


Can make a input Hidden:

<input type="hidden" value="123" name="senha">

The value of this input is also sent with the remaining data, but is not visible on the page.

  • That is what I wanted, thank you very much for your reply

  • You’re welcome @Williamcézar, I’m glad you decided... But I emphasize that if some security is needed in this operation it is advisable to store the value on the server side also to check later (like Sergio said, sessions would be the best http://www.w3schools.com/php/php_sessions.asp

  • In this case here does not need any security, these values that I am passing is just to be able to complete the required data, I am added a page to a system already ready so I am not so free to change some things, but what you’ve given me has helped quite a lot thank you.

  • OK good then @Williamcézar

  • just one more expensive thing , if it’s not too much trouble, I thought it was working but the values are coming in null, I left my inputs : '<input type="Hidden" value="Leet" name="last name" id=surname-registration>' I tried to put this inside a '<div class="form-Grou p>' but did not help, still null.

  • @Williamcézar Has an html error: <div class="form-grou´p>, should close like this <div class="form-group">, and ...id="sobrenome-cadastro"... and you have to access the value in this server-side case like this: $_POST['sobrenome'] whose value will be leet

  • I have a working example of an input of that : '<form:input path="surname" maxlength="100" size="60" id="surname-registration" placeholder='SURNAME' cssClass="form-registration-home-small required" tabindex="2"/>' But otherwise I would pass the value and it would not appear , the form group is right in the code , just wrong here.

  • There must be something missing here: http://www.w3schools.com/tags/tryit.asp?filename=tryhtml5_input_type_hidden @Williamcézar

Show 3 more comments

Browser other questions tagged

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