Announcement

Collapse
No announcement yet.

PHP Radion Button Retention

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • PHP Radion Button Retention

    My php retention does not work on these radio buttons
    Its works only on first radio if I use <?php if($input_p=="1")

    Declared variables
    Code:
    $errPackage=0;
    $input_p=-1;
    Retention code

    Code:
    <input type="radio"	name="Package" value="premium" <?php if($input_p=="premium") echo "checked"?>/> Premium<br>
    <input type="radio"	name="Package" value="compact" <?php if($input_p=="compact") echo "checked"?>/> Compact<br>
    <input type="radio"	name="Package" value="family"/><?php if($input_p=="Family") echo "checked"?> Family<br>
    <?php if ($errPackage) echo "Please select a Package" ?>

  • #2
    How are you checking for the value of the radio button? Should be by _POST so try this, plus your closing tag on the last radio button is in the wrong spot.

    PHP Code:
    <input type="radio"    name="Package" value="premium" <?php if($_POST['Package']=="premium") echo "checked=checked"?> /> Premium<br>
    <input type="radio"    name="Package" value="compact" <?php if($_POST['Package']=="compact") echo "checked=checked"?> /> Compact<br>
    <input type="radio"    name="Package" value="family"<?php if($_POST['Package']=="Family") echo "checked=checked"?> />Family<br>
    <?php if ($errPackage) echo "Please select a Package" ?>
    Have a Script or Snippet you want to share?

    WWW Standards: HTML 4.01,
    HTML 5, CSS2.1, CSS3, XHTML 1.0
    PHP Standards: PHP Standards

    Comment


    • #3
      thanks i manage to find that error

      Comment

      Working...
      X