Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

HowTo deal with Radio buttons?

Status
Not open for further replies.

Naits

Programmer
Oct 10, 2001
90
NO
How can i use radi buttons?
here is a snitt of my files:

the form file:
<input type=&quot;radio&quot; name=&quot;GTA2FileType&quot; value=&quot;files&quot;>GTA2 File(s)<br>
<input type=&quot;radio&quot; name=&quot;GTA2FileType&quot; value=&quot;car&quot;>GTA2 Car(s)<br>

the action file:
if ($car.checked){

$fp = fopen(&quot;g.txt&quot;, &quot;w&quot;);
fwrite ($fp,&quot;A: $name&quot;);
fwrite ($fp,&quot;C: $Comments&quot;);
fclose ($fp);
}

but it does make the file &quot;g.txt&quot; when the &quot;car&quot; is checked and when &quot;files&quot; are checked. What have i done wrong??
 
Not sure why you are using the checked property - and also the variable car - here is how I thought you might wnat to do it.

if($GTA2FileType == &quot;car&quot;){
$fp = fopen(&quot;g.txt&quot;, &quot;w&quot;);
fwrite ($fp,&quot;A: $name&quot;);
fwrite ($fp,&quot;C: $Comments&quot;);
fclose ($fp);

}

else if($GTA2FileType == &quot;files&quot;){
echo &quot;Do file stuff.&quot;;
}


As that code stands, there is no variable $car - there is only $GTA2FileType. [?]
 
Thanx!!! And i choosed to have &quot;car&quot; and &quot;files&quot; because it is an uploading form for my GTA site I am working on.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top