I have a checkblank fields program, and everything is going fine with redisplaying the text entered, when they need to enter a required field, all except for the radio buttons. here's what I have. any suggestions?
<html>
<head><title>Empty fields</title></head>
<body>
<?php
include 'head.asp';
/ set up array of field labels /
/ on left of => is the variable, and right of => is
the name of the field in the array, i think /
$label_array = array ( "name" => "Name",
"email" => "Email",
"members" => "How Many Members",
"memberName" => "Member Names",
"genre" => "Genre",
"wherePlayed" => "Where have you played",
"whoWithLoc" => "Who With Locally",
"whoWithNat" => "Who With Nat'l",
"label" => "Are you on a label",
"labelName" => "Label Name",
"manager" => "Do you have a manager",
"managerName" => "Manager Name",
"whenFormed" => "When did you form(YYYY/MM/DD)",
"wouldPay" => "Do you want to hook up with a promoter",
"favVenue" => "Fav Venues to play",
"favBooker" => "Fav promoter to work with",
"siteLink" => "Link to site",
"origin" => "Where did you form",
"sold" => "Records sold",
"disco" => "Discography",
"favPromoCo" => "Fav Promotions Company to work with",
"howMuch" => "How much would you pay for promotion",
"favPlay" => "Fav bands to play shows with",
"draw" => "What realistically is your draw");
/ check each field except middle name for blank fields /
foreach ($HTTP_POST_VARS as $key => $value)
{
$skip_array = array("siteLink", "memberName", "whoWithNat",
"origin", "sold", "howMuch", "label",
"labelName","managerName", "favPromoCo",
"favBooker", "disco");
foreach ($HTTP_POST_VARS as $key => $value)
{
if (!in_array($key,$skip_array))
{
if ($value == "" )
{
$blank_array[$key] = "blank";
}
}
}
}
/ if any fields were blank, display error message and form /
if (@sizeof($blank_array) > 0) //if any blank fields were found
{
echo "<br><br><b>You forgot some...please enter:</b><br><br>";
/ display list of missing information /
foreach($blank_array as $key => $value)
{
echo " {$label_array[$key]}<br>";
}
/ redisplay form /
echo "<p><hr>
<form action='checkBlank.php' method='post'>
<p><B>{$label_array['name']}:
<img src='images/sp.gif'>
<input type='text' class='input' name='name' value=$name></p>
<p><B>{$label_array['email']}:
<img src='images/sp.gif'>
<input type='text' class='input' name='email' value=$email>
</p>
<p><B>{$label_array['siteLink']}:
<img src='images/sp.gif'>
<input type='text' class='input' name='siteLink' value=$siteLink>
</p>
<p><B>{$label_array['whenFormed']}:
<img src='images/sp.gif'>
<input type='text' class='input' name='whenFormed' value=$whenFormed>
</p>
<p><B>{$label_array['origin']}:
<img src='images/sp.gif'>
<input type='text' class='input' name='origin' value=$origin>
</p>
<p><B>{$label_array['members']}:
<img src='images/sp.gif'>
<input type='text' class='input' name='members' value=$members>
</p>
<p><B>{$label_array['memberName']}:
<img src='images/sp.gif'>
<input type='text' class='input' name='memberName' value=$memberName>
</p>
<p><B>{$label_array['genre']}:
<img src='images/sp.gif'>
<input type='text' class='input' name='genre' value=$genre>
</p>
<p><B>{$label_array['draw']}:
<img src='images/sp.gif'>
<input type='text' class='input' name='draw' value=$draw>
</p>
<p>
* <B>{$label_array['wherePlayed']}:?</p>
<textarea name='wherePlayed' rows='4' cols='30'
class='input' wrap='physical'>$wherePlayed
</textarea>
<p>
* <B>{$label_array['whoWithLoc']}:</p>
<textarea name='whoWithLoc' rows='4' cols='30'
class='input' wrap='physical'>$whoWithLoc
</textarea>
<p><B>{$label_array['whoWithNat']}:</p>
<textarea name='whoWithNat' rows='4' cols='30'
class='input' wrap='physical'>$whoWithNat
</textarea>
// HERE's THE PROBLEM ________
<? $label=$_POST['label'];
//you could also try this:
$label=$label_array['label'];
?>
Yes<input type='radio' name='label' value='yes'
<? if ($label=='yes') echo "CHECKED"; ?>>
No <input type='radio' name='label' value='no'
<? if ($label=='no') echo "CHECKED"; ?>>
<p><B>{$label_array['labelName']}:
<img src='images/sp.gif'>
<input type='text' class='input' name='labelName'
value=$labelName>
</p>
<p><B>{$label_array['manager']}:
<img src='images/sp.gif'>
Yes<input type='radio' name='manager' value=$manager>
No<input type='radio' name='manager' value=$manager>
</p>
<p><B>{$label_array['managerName']}:
<img src='images/sp.gif'>
<input type='text' class='input' name='managerName'
value=$managerName>
</p>
<p><B>{$label_array['wouldPay']}:
<img src='images/sp.gif'>
Yes<input type='radio' name='wouldPay' value=$wouldPay>
No<input type='radio' name='wouldPay' value=$wouldPay>
</p>
<p><B>{$label_array['howMuch']}:
<img src='images/sp.gif'>
<input type='text' class='input' name='howMuch'
value=$howMuch>
</p>
<p><B>{$label_array['favVenue']}:</p>
<textarea name='favVenue' rows='4' cols='30'
class='input' wrap='physical'>$favVenue
</textarea>
<p><B>{$label_array['favPlay']}:</p>
<textarea name='favPlay' rows='4' cols='30'
class='input' wrap='physical'>$favPlay
</textarea>
<p><B>{$label_array['favBooker']}:
<img src='images/sp.gif'>
<input type='text' class='input' name='favBooker'
value=$favBooker>
</p>
<p><B>{$label_array['sold']}:
<img src='images/sp.gif'>
<input type='text' class='input' name='sold'
value=$sold>
</p>
<p><B>{$label_array['disco']}:</p>
<textarea name='disco' rows='4' cols='30'
class='input' wrap='physical'>$disco
</textarea>
<br><br>
</table>
<input type='submit' value='Send' class='button'>
</form>";
include 'bottomnav.asp';
include 'footer.asp';
exit();
}
else
{
include 'processFormBand.php';
echo "<center><p>
You have been added to the BANDS database. Thank you!</center></p>";
}
?>
</body>
</html>