Skip to main content
Participant
May 31, 2006
質問

setting form attribute value with php

  • May 31, 2006
  • 返信数 1.
  • 186 ビュー
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?
このトピックへの返信は締め切られました。

返信数 1

Participating Frequently
June 1, 2006
This code should work

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