Huge problem. When people re-put in their info, if they have missed a required field, it will only fill in partial strings. i.e. if their band name was Band A, it would only refill in "Band", -- is this because it is separated by a space? If so, how can I fix that?? Please help, thank you!!!
CODE:
<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" => "Band Name",
"email" => "Contact Email",
"members" => "How Many Members",
"memberName" => "Names of band members",
"genre" => "Genre",
"wherePlayed" => "Where have you played around Seattle? (separate with commas)",
"whoWithLoc" => "Who have you played with locally? (separate with commas)",
"whoWithNat" => "Nationally? (separate with commas)",
"label" => "Are you on a label",
"labelName" => "If yes, what's the label name",
"manager" => "Do you have a manager",
"managerName" => "If yes, what is their name",
"whenFormed" => "Year formed (YYYY)",
"wouldPay" => "Would you like to hook up with a promoter",
"favVenue" => "What are your favorite venues in and around Seattle to play? (Top 5 - separate with commas)",
"favBooker" => "Who is your favorite show promoter to work with from Seattle area? (first AND last names please)",
"siteLink" => "Link to site",
"origin" => "Where did your band form",
"sold" => "Records sold",
"disco" => "Discography",
"favPromoCo" => "What is your fav promotions company to work with?",
"howMuch" => "If so, how much would you pay",
"favPlay" => "What are your favorite bands in and around Seattle to play shows with? (Top 5 - separate with commas)",
"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",
"sold", "label",
"labelName","managerName", "favPromoCo",
"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'>[url]http://[/url]
<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>* How many people can you realistically draw?
<select name='draw' class='input' value=$draw>
<option value='still building'>still building
<option value='Under 25">Under 25
<option value='25-50'>25-50
<option value='50-100'>50-100
<option value='100-200'>100-200
<option value='200-300'>200-300
<option value='300-500'>300-500
<option value='500+'>500+
</select>
</p>
<?php
echo "
<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>
";
$label=$_POST['label'] ?>
<br>
<p><B>Are you on a label?<img src="images/sp.gif">
Yes<input type='radio' name='label' value='yes'
<? if ($label=='yes') echo "CHECKED"; ?>>
No <input type='radio' name='label' value='no'
<? if ($label<>'yes') echo "CHECKED"; ?>>
</p>
<?php
echo "
<p><B>{$label_array['labelName']}:
<img src='images/sp.gif'>
<input type='text' class='input' name='labelName'
value=$labelName>
</p>
";
$label=$_POST['manager'] ?>
<p><B>Do you have a manager?<img src="images/sp.gif">
Yes<input type='radio' name='manager' value='yes'
<? if ($label=='yes') echo "CHECKED"; ?>>
No <input type='radio' name='manager' value='no'
<? if ($label<>'yes') echo "CHECKED"; ?>>
</p>
<?php
echo "
<p><B>{$label_array['managerName']}:
<img src='images/sp.gif'>
<input type='text' class='input' name='managerName'
value=$managerName>
</p>
";
$label=$_POST['wouldPay'] ?>
<p><B>* Would you like to hook up with a promoter?<img src="images/sp.gif">
Yes<input type='radio' name='wouldPay' value='yes'
<? if ($label=='yes') echo "CHECKED"; ?>>
No <input type='radio' name='wouldPay' value='no'
<? if ($label<>'yes') echo "CHECKED"; ?>>
</p>
<?php
echo "
<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['favPromoCo']}
<img src='images/sp.gif'>
<input type='text' class='input' name='favPromoCo'
value=$favPromoCo>
</p>";
?>
<p>* How many records have you sold?
<select name='sold' class='input' value=$sold>
<option value='0-50'>0-50
<option value='50-100'>50-100
<option value='100-250'>100-250
<option value='250-500'>250-500
<option value='500-1000'>500-1000
<option value='1000-2000'>1000-2000
<option value='2000+'>2000+
</select>
</p>
<?php
echo "
<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';
}
?>
</body>
</html>