pretty sure my title needs to be fixed but anyhow, i have this loop. background info, i have 36 input "types" that need to be inserted 1 by 1. if the value has something.. set to a variable, if not set it to NULL.
MY question is, is there a loop i can perform to do this without listing 36 of these things.
using php version 5.2.17
if (!empty($_POST['type1'])){
$type1 = $_POST['type1'];
}
else
$type1 = NULL;
if (!empty($_POST['type2'])){
$type2 = $_POST['type2'];
}
else
$type2 = NULL;
if (!empty($_POST['type3'])){
$type3 = $_POST['type3'];
}
else
$type3 = NULL; // to 36...
php/html
<?php
for ($i = 1; $i < 37; $i++){
echo "Type$i:<input name='type$i' type='text' size='20' maxlength='35' /><br />";
}
?>
edit: I don't want to use an array.
type[]