SilvioCro SilvioCro - 1 year ago 106
HTML Question

HTML form with jQuery

I'm making HTML form(sign up), I have tipical fields/inputs(username, password, e-mail etc...). My plan is to push whole HTML form into other .php file(with POST method). Second .php file will do MySQL part(put user into MySQL base...). But sign up contains parts that I need push into other .php file, only problem is - these parts aren't in HTML form.
So, I have part in which user can select skin. User on sign up(when page loads) get random skin ID. For ID I use PHP var(eg. $var;). When user click on skin image, it'll call jQuery function.
I'm not sure how to chage value for PHP var later(I think it's
impossibly), and I don't Know how to push "non-HTML-form" values into other .php file. Thanks!

@ EDIT: Video is here

@ EDIT 2: Code is here

Answer Source

Yes, you can easily use hidden fields and send OR post data using ajax you have to use form submit method OR ajax call for posting data.

<!-- this your simple html form with all data that user inputs -->
<form onsubmit="javascript: return false;">
    <input type="text" value="" name="username" placeholder="Username" />
    <!-- You can easily pass hidden values using type="hidden" -->
    <input type="hidden" name="id" value="10" />
    <input type="submit" name="submit" value="Submit Form" />

<!-- Now you can post all serialized data one to another file -->
<script src=""></script>
$("form").submit(function(event) {
   var data = $(this).serialize();
     type: "POST",
     url: "yourfile.php",
     data: data,
     success: function(response){
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download