Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4071196
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T16:43:34+00:00 2026-05-20T16:43:34+00:00

I’ve got a registration box working otherwise apart from the fact that it won’t

  • 0

I’ve got a registration box working otherwise apart from the fact that it won’t send the textfield value to my php script – is .val() the right function? I know there’s probably a hundred thins wrong with the way I’ve done this, but I’d appreciate any input.

$(document).ready(function(){  
                $("form#joinus").submit(function() {
                var gender = $('#gender').attr('value');  
                var age = $('#age').attr('value');
                var gamer = $('#gamer').attr('value');
                var name = $('#name').val();
                console.log("register AJAX input: " + "gender="+ gender +"& age="+ age +"& gamer=" + gamer +"& name=" + name);
                var display = document.getElementById('feedback');
                    $.ajax({  
                        type: "POST",  
                        url: "scripts/register.php",  
                        data: "gender="+ gender +"& age="+ age +"& gamer=" + gamer +"& name=" + name,
                        success: function(msg){  
                            $('form#joinus').hide(function(){$('div.success').fadeIn();});  
                            display.innerHTML = msg;
                        }
                    });
                return false;  
                });  
            });

HTML:

form id="joinus" method="post" action="">
    <fieldset>
        <table style="text-align: left">
            <tr><td>Gender:</td><td><select name="gender" id="gender">
                <option value="male">Male</option>
                <option value="female">Female</option>
            </select></td></tr>
            <tr><td>Age:</td><td><select name="age" id="age">
                <option value="18">18</option>
                <option value="19">19</option>
                <option value="20">20</option>
                <option value="21">21</option>
                <option value="22">22</option>
                <option value="23">23</option>
                <option value="24">24</option>
                <option value="25">25</option>
                <option value="26">26</option>
                <option value="27">27</option>
                <option value="28">28</option>
                <option value="29">29</option>
                <option value="30">30</option>
                <option value="31">31</option>
                <option value="32">32</option>
                <option value="33">33</option>
                <option value="34">34</option>
                <option value="35">35</option>
                <option value="36">36</option>
                <option value="37">37</option>
                <option value="38">38</option>
                <option value="39">39</option>
                <option value="40">40</option>
                <option value="41">41</option>
                <option value="42">42</option>
                <option value="43">43</option>
                <option value="44">44</option>
                <option value="45">45</option>
                <option value="46">46</option>
                <option value="47">47</option>
                <option value="48">48</option>
                <option value="49">49</option>
                <option value="50">50</option>
                <option value="51">51</option>
                <option value="52">52</option>
                <option value="53">53</option>
                <option value="54">54</option>
                <option value="55">55</option>
                <option value="56">56</option>
                <option value="57">57</option>
                <option value="58">58</option>
                <option value="59">59</option>
                <option value="60">60</option>
                <option value="61">61</option>
                <option value="62">62</option>
                <option value="63">63</option>
                <option value="64">64</option>
                <option value="65">65</option>
                <option value="66">66</option>
                <option value="67">67</option>
                <option value="68">68</option>
                <option value="69">69</option>
                <option value="70">70+</option>
            </select></td></tr>
            <tr><td>Would you describe yourself as a "gamer"? (This refers to video games of any sort)</td><td><select name="gamer" id="gamer">
                <option value="yes">Yes</option>
                <option value="no">No</option>
            </select></td></tr>
            <tr><td>Enter the name you would like to use for any highscores (this may be seen by other users)</td><td><input type="text" id="name" name="name" />
        </table>
        <button class="button positive"> Submit </button>  
    </fieldset>
</form>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-20T16:43:35+00:00Added an answer on May 20, 2026 at 4:43 pm

    I’ve tried your code in a test project and it works fine.

    However, if I add another element further up with an ID of name, then I get the behaviour you describe.

    I’d suggest you’ve got duplicate elements with the same ID.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've got a string that has curly quotes in it. I'd like to replace
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I'm trying to create an if statement in PHP that prevents a single post
I'm working with an upstream system that sometimes sends me text destined for HTML/XML
I want to count how many characters a certain string has in PHP, but
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I would like to count the length of a string with PHP. The string
For some reason, after submitting a string like this Jack’s Spindle from a text

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.