SitePoint Sponsor

User Tag List

Results 1 to 4 of 4

Thread: Extract Value

  1. #1
    SitePoint Addict
    Join Date
    Jan 2005
    Location
    North America
    Posts
    336
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Unhappy Extract Value

    I need to be able to get the value from the input box below to send a PHP script. This value is generated based on other fields in the form using Javascript.

    <input type="text" name="need" value="0" onFocus="this.blur()">

    The value of "0" is auto set because it starts out as 0 and as you fill in other details the number increases. I have tried to remove the "0" and continue but when posting to a PHP script ($_POST['needs']) it shows up blank.

    Any suggestions? help appreciated!

    Thanks.

  2. #2
    SitePoint Addict darkwater23's Avatar
    Join Date
    Nov 2005
    Location
    Omaha, NE
    Posts
    335
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hello!

    First thing I noticed is that your input name is "need" and your PHP script is "needs". They have to match, of course. If that's just a typo on the post, then I'm not sure. Even if something in the JS was wrong, PHP should at least get a "0" when value is set.

    You might have to post more code if the first solution does not apply.

    Good luck!

  3. #3
    SitePoint Addict
    Join Date
    Jan 2005
    Location
    North America
    Posts
    336
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hey! Thanks for the post.

    Yes, that is a type on my part. I have tried a few methods but is seems because the value is somehow not being updated in the input tag PHP can't pick it up - it only gets the "0"!

    Any further thoughts?

  4. #4
    SitePoint Wizard
    Join Date
    Nov 2004
    Location
    Nelson BC
    Posts
    2,310
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You are updating the input value with javascript and then submitting the form? - it should work. Post the javascript code you use to change the input value.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •