Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

setting form attribute value with php

New Here ,
May 30, 2006 May 30, 2006
i am having trouble setting the checked attribute value of a radio button based on the url parameter search. if search == all then checked == checked else checked == unchecked.

<input type="radio" name="search" value="all" checked="<?php if ($_GET["search"] == "all") { echo"checked";} else { echo"unchecked";} ?>" />

what am i doing wrong?
TOPICS
Server side applications
183
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Enthusiast ,
Jun 01, 2006 Jun 01, 2006
LATEST
This code should work

<input type="radio" name="search" value="all" <?php if ($_GET["search"] == "all") { echo "checked";} ?> />
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines