Ben formu $ max_avatars seçenekleri ile oluşturulan fonksiyon CreateForm benim doldurulmuş diziler geçmek, ama ne zaman bu yüzden adı yok veya değeri var. Neden benim diziler boş oluyor?
<?php
$avatar_image_name = array('hacker','samurai','cool','happy','thatsnice','angry','tv','bang');
$avatar_name = array('Hacker','Samurai','Cool','Happy','That\'s nice','Angry','TV','Bang');
$max_avatars = 6;
createform($max_avatars, $avatar_image_name, $avatar_name);
?>
Fonksiyonu CreateForm:
function createform($max_avatars, $avatar_image_name, $avatar_name)
{
$string ='<table id="formtable">
<tr><td class="formtext">Name:</td><td><input type="text" name=name size=25 /></td></tr>
<tr><td class="formtext">Trip:</td><td><input type="text" name=trip size=25 /> (<font style="color: #ff0000">Don\'t use your password</font>)</td></tr>
<tr><td class="formtext">Comment</td><td><textarea name=post rows="4" cols="50"></textarea></td></tr>
<tr><td class="formtext">Avatar:</td>
<td>
<select name=avatar>';
for($i = 0; $i < $max_avatars; $i++){
$string = ($string . '<option value="'.$avatar_image_name[i].'">'.$avatar_name[i].'</option>');
}
$string = ($string . '</select>
</td>
<tr><td class="formtext">Extra</td><td>Fortune: <input type="radio" name="extra" value="fortune" /> Poker: <input type="radio" name="extra" value="poker" /></td></tr>
</table>
<input type=submit value="Submit" id="submitbutton">');
echo $string;
}