Jump to content

[SOLVED] Forms


Daney11

Recommended Posts

Hey guys.

 

Im having a problem.

 

Using the below code works:

<input type='text' size='10' name='squad_number[$i]' value='{$Squad_PlayerRow['squad_number']}' />

 

However i want to use a dropdown box instead. Using the below code doesnt work:

<select name="squad_number[$i]"><?php for ($i=0; $i<=99; $i++) { if($i<10) { $val="0$i"; } else { $val=$i; } echo "<option value=\"$val\""; if ($val==$Squad_PlayerRow['squad_number']) { echo " selected"; } echo ">$val</option>"; } ?></select>

 

Any ideas why the drop down doesnt work?

 

Thanks

Link to comment
https://forums.phpfreaks.com/topic/149746-solved-forms/
Share on other sites

Basically.... I want to be able to select numbers from 00-99 using a dropdown menu. I have this code below which you can input a number and it works fine and updates all the players within my database.

 

echo "<input type='text' size='10' name='squad_number[$i]' value='{$Squad_PlayerRow['squad_number']}' />";

 

However, using the below peice of code. The drop down menu shows numbers from 00-99 but does not update all the players in the database.

 

echo "<select name='squad_number[$i]'>";
for ($i=0; $i<=99; $i++) { if($i<10) { $val="0$i"; } else { $val=$i; } 
echo "<option value='$val'"; 
if ($val==$Squad_PlayerRow['id']) { 
echo " selected"; } 
echo ">$val</option>";
}
echo "</select>";

Link to comment
https://forums.phpfreaks.com/topic/149746-solved-forms/#findComment-786343
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.