I will assume getValue is a custom function. My recommendation would be the following:
<?php
// arrays to facilitate foreach loop
$hidden_fields = array('siteId', 'itemid', 'bidqty'); // store hidden field names
$hidden_values = array(); // store the hidden field values
foreach ($hidden_fields as $key => $value) {
// fill the values array using the values from fields array
$hidden_values[$value] = getValue($value, $localurl);
}
<?php
echo "
form action=\"http://$domain/mailer/create.php\" name=\"create\" method=\"post\" />
input type=\"hidden\" name=\"random\" value=\"$random\" />";
// output hidden fields
foreach ($hidden_values as $key => $value) {
echo '<input type="hidden" name="', $key, '" value="', $value, '" />';
}
?>
You could do this with a single array, but I feel this is more flexible.
Jason McCreary
2010-07-20 18:17:58