Member Offer
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Help the muppet, pleeeeaaaase, simple radio button problem.

Discussion in 'Website Design Forum:' started by Jazajay, Feb 22, 2009.

  1. Jazajay

    Jazajay Active Member

    Right I have either been looking at it for too long or I have just forgotten the basics.
    Anyway I cant retrieve the value of a radio button, of all the problems in all the world why I cant do it I have no idea, but I flaming cant. :mad:

    Here's what I have ~
    <label for="a">Value1 ~</label> <input id="a" type="radio" name="type" value="value1" checked="checked" /><br />
    <label for="b">Value2 ~</label> <input id="b" type="radio" name="type" value="value2" />

    Then once the form is submitted, my PHP to retrieve it is ~
    ."</p>Type of work: ".strip_tags($_POST['type'])."</p><p>".

    Now what ever I select all I get is value1 outputted.

    You can mock at the dumbass by all means but please tell me why, as I cant work it out. Of all the problems. :D

    Jaz :)

    Purple ~ XHTML
    Red ~ PHP
  2. Skipper

    Skipper Junior Member

    Late reply, but if you're still having the problem; It looks fine to me, as far as the syntax and markup goes. I don't see what the problem could be? o_O

    Well, start from the basics.

    Try switching the 'checked' attribute around to another radio button? If the value of that button sends (regardless of the radio button checked), then it must be an issue with the attribute (I couldn't see that, however). Same case if you were to take out the 'checked' attribute from all radio inputs - attribute issue.

    Stop the use of the strip_tags() function? Maybe it's doing something funky to your strings - even though I highly doubt it, it's worth a shot. PHP can be rather...odd.

    Switch browsers temporarily? Maybe a specific browser is sending the post information incorrectly.

    You probably got it sorted out by now, though - but if you haven't, good luck to you. ^^

    ` Skipper
  3. Jazajay

    Jazajay Active Member

    Yeah that does make sense take it to it's most basic level.
    The problem is cross browser through and I cant see as you rightly say how strip_tags() or the checked value effect it. I have moved on since then as that is the most "bizarrest" issue I have ever come across.

    But now the other stuff is done I'll go back and sort it, I hate things that beat me and this is just so random, at least it's not a mistake in my code. :D

    Thanks for the reply much appreciated skip.
  4. br3n

    br3n Senior Member

    a knowledgeable friend of mine said the code was fine so the error must be elsewhere.\

    Not that, that helps at all:D
  5. Jazajay

    Jazajay Active Member

    No that does buddy as I was staring at the code thinking that was where the issue lay, obviously it clearly doesn't now I have spent some time away from it, but it's always good to be told the obvious when you just cant see it IMO. :)

    Hope your well, haven't seen you around here in a while, hope it's not due to anything I've said?
  6. Skipper

    Skipper Junior Member

    No worries, of course. ^^ Just throwing the basic cents out there to begin with.

    Could we see the entire source of the page the form is in (Output from PHP / ASP), and the page the form information is submitted to (PHP / ASP source, only up to the point where the $_POST['type'] value is outputted for the first time) - if it's not too sensitive?

    EDIT: Also, I made a test script on my own home server. I set up a proper transitional XHTML document with its necessities, and placed a form inside the body with your inputs (copy and pasted for perfection ;D). Values transfer just fine.

Share This Page