Hi all!

I must not be seeing something here.

I have a form where some of the fields are optional and some are required,
however when you click submit, the form will only continue to the next page
if ALL fields are completed, but the data is entered into the database just
fine in all instances.

I have looked at this all night and am just not seeing the issue. The
scripted was generated my MacSQL 2.0.1 if that helps.

Any and all ideas on what I am doing wrong would be greatly appreciated.

System...
OS; Mac OSX 10.0.4
PHP: 4.0.6
mySQL: 3.23.32
Apache: 1.3.14
my brain: back in beta

Storm Williams


<?PHP
    $err=0;
    $FormDict = $HTTP_GET_VARS;
    if ($HTTP_POST_VARS['_wss']) {
        $FormDict = $HTTP_POST_VARS;
    }
    $errUrl = 'errorPit/signerror.html';
    $thanksUrl = 'putPix.php';
        if ($FormDict['_wss']) {
        mysql_pconnect("localhost", "root","passwordgoeshere");
        mysql_select_db("nuke");
        $stmt = "insert into artist_contract_info
(plaversion,email,bandurl,state,plaagree,goldplatflag,city,pwd2,addresssecon
d,bandbio,contactfirstname,shoppingurl,zip,genre,pwd1,country,taxid,contactl
astname,bandname,addressfirst) values (";
        $fields = 
array("pla","email","band_url","state","pla_agree","gold_record","city","pas
sword_2","address2","band_bio","first_name","ecommerce_url","zip_code","genr
e","password_1","country","tax_id","last_name","band_name","address1");
        $checks = 
array("r:-:2:","r:-:2:","-:-:2:","r:-:2:","r:-:1:","-:-:1:","r:-:2:","r:-:2:
","-:-:2:","-:-:2:","r:-:2:","-:-:2:","r:-:2:","r:-:0:","r:-:2:","r:-:2:","r
:-:2:","r:-:2:","r:-:2:","r:-:2:");
        $mid = mysql_insert_id();
        setcookie ("downslamArtist", "$mid");
        for($i=0; $i < 20; $i++) {
            $val = $FormDict[$fields[$i]];
            $c = preg_split("/:/", $checks[$i]);
            if ((strcmp($c[0], 'r') == 0) && !$val) $err++;
            if (strcmp($c[1], 'l') == 0) $val = strtolower($val);
            if (strcmp($c[1], 'u') == 0) $val = strtoupper($val);
            if ($c[2] && strlen($val) < $c[2]) $err++;
            if ($c[3] && !$c[3]($val)) $err++;
            if ($i > 0) $stmt .= ',';
            $stmt .= "'" . AddSlashes($val) . "'";
        }
        $stmt .= ')';
        if (!mysql_query($stmt))
            $err++;
        if ($err) 
            $thanksUrl = $errUrl;
        header("Location: $thanksUrl");
        exit;
    }
?>
<?PHP
    /*     This code was generated via MacSQL Monitor (available at
        <http://www.rtlabs.com/macsql/>) and is copyright 2001 Runtime Labs,
Inc.
        Registered users of MacSQL Monitor are granted unlimited right to
use
        this code on websites they build. This notice must be included
        with this code.
        
        This code is provided AS IS with no warranty of any kind.
    */
    function isInteger($val) {
        return preg_match("/^\d+$/", $val);
    }
    function isAlphaNum($val) {
        return preg_match("/^\w+$/", $val);
    }
    function hasNonAlphaNum($val) {
        return preg_match("/\W/", $val);
    }
    function isCCExpDate($val) {
        $d = preg_split("/\//", $val);
        if (strlen($d[1]) < 3) $d[1] += 2000;
        return (($d[0] > 0) && ($d[0] <= 12) && ($d[1] > 2000) && ($d[1] <
2050));
    }
    function isDate($val) {
        return preg_match("#\d\d?[-/]\d\d?[-/]\d{2,4}#", $val);
    }
?>
<html>
<head>
<title>sign YOUR band</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>

<body bgcolor="#FFFFFF" text="#000000">
<img src="images/admin/signIcon.gif" width="51" height="50"><font
face="Verdana, Arial, Helvetica, sans-serif"><b><font size="7">
<font color="#9900FF" size="4">sign YOUR band</font></font></b></font>
<form name="form2" method="post" action="" enctype="multipart/form-data">
  <p><font size="2"><b><font face="Verdana, Arial, Helvetica,
sans-serif">All 
    fields in <font color="#FF0000">RED</font> are
required.</font></b></font></p>
  <p>&nbsp;</p>
  <table width="600" border="0">
    <tr bgcolor="#FF0000">
      <td colspan="3">
        <textarea name="pla" cols="80" rows="30" wrap="VIRTUAL">PLA Version
1.0

Gobs or text goes here.</textarea>
      </td>
    </tr>
    <tr bgcolor="#FF0000">
      <td width="156">
        <input type="checkbox" name="pla_agree" value="checkbox">
        <font face="Verdana, Arial, Helvetica, sans-serif" size="2">Agree?
</font></td>
      <td width="164">&nbsp;</td>
      <td width="266">&nbsp;</td>
    </tr>
    <tr> 
      <td width="156" bgcolor="#FFFFFF">&nbsp;</td>
      <td width="164" bgcolor="#FFFFFF">&nbsp;</td>
      <td width="266">&nbsp;</td>
    </tr>
    <tr> 
      <td width="156" bgcolor="#FF0000"><b><font face="Verdana, Arial,
Helvetica, sans-serif" size="1">Band
        Name</font></b></td>
      <td width="164" bgcolor="#FF0000">
        <input type="text" name="band_name" MAXLENGTH="100">
      </td>
      <td width="266">&nbsp;</td>
    </tr>
    <tr> 
      <td width="156"><b><font face="Verdana, Arial, Helvetica, sans-serif"
size="1">Contact 
        Info</font></b></td>
      <td width="164">&nbsp;</td>
      <td width="266">&nbsp;</td>
    </tr>
    <tr> 
      <td width="156" bgcolor="#FF0000"><b><font face="Verdana, Arial,
Helvetica, sans-serif" size="1">Genre</font></b></td>
      <td width="164" bgcolor="#FF0000">
        <select name="genre">
          <option value="alternative" selected>Alternative</option>
          <option value="blues">Blues</option>
          <option value="celtic">Celtic</option>
          <option value="classical">Classical</option>
          <option value="country">Country</option>
          <option value="electronica">Electronica</option>
          <option value="experimental">Experimental</option>
          <option value="folk">Folk &amp; Traditional</option>
          <option value="industrial">Industrial</option>
          <option value="jazz">Jazz</option>
          <option value="latin">Latin</option>
          <option value="metal">Metal</option>
          <option value="new_age">New Age</option>
          <option value="rap">Rap &amp; Hip Hop</option>
          <option value="religious">Religious</option>
          <option value="rock">Rock</option>
          <option value="ska">Ska</option>
          <option value="soul">Soul + R&amp;B</option>
          <option value="spoken_word">Spoken Word</option>
          <option value="world">World</option>
        </select>
      </td>
      <td width="266">&nbsp;</td>
    </tr>
    <tr> 
      <td width="156" bgcolor="#FF0000"><b><font face="Verdana, Arial,
Helvetica, sans-serif" size="1">First
        Name</font></b></td>
      <td width="164" bgcolor="#FF0000">
        <input type="text" name="first_name" MAXLENGTH="100">
      </td>
      <td width="266">&nbsp;</td>
    </tr>
    <tr> 
      <td width="156" bgcolor="#FF0000"><b><font face="Verdana, Arial,
Helvetica, sans-serif" size="1">Last
        Name</font></b></td>
      <td width="164" bgcolor="#FF0000">
        <input type="text" name="last_name" MAXLENGTH="100">
      </td>
      <td width="266">&nbsp;</td>
    </tr>
    <tr> 
      <td width="156" bgcolor="#FF0000"><b><font face="Verdana, Arial,
Helvetica, sans-serif" size="1">Address
        1</font></b></td>
      <td width="164" bgcolor="#FF0000">
        <input type="text" name="address1" MAXLENGTH="100">
      </td>
      <td width="266">&nbsp;</td>
    </tr>
    <tr> 
      <td width="156"><b><font face="Verdana, Arial, Helvetica, sans-serif"
size="1">Address 
        2</font></b></td>
      <td width="164">
        <input type="text" name="address2" MAXLENGTH="100">
      </td>
      <td width="266">&nbsp;</td>
    </tr>
    <tr> 
      <td width="156" bgcolor="#FF0000"><b><font face="Verdana, Arial,
Helvetica, sans-serif" size="1">City</font></b></td>
      <td width="164" bgcolor="#FF0000">
        <input type="text" name="city" MAXLENGTH="100">
      </td>
      <td width="266">&nbsp;</td>
    </tr>
    <tr> 
      <td width="156" bgcolor="#FF0000"><b><font face="Verdana, Arial,
Helvetica, sans-serif" size="1">State/Province</font></b></td>
      <td width="164" bgcolor="#FF0000">
        <input type="text" name="state" MAXLENGTH="100">
      </td>
      <td width="266">&nbsp;</td>
    </tr>
    <tr> 
      <td width="156" bgcolor="#FF0000"><b><font face="Verdana, Arial,
Helvetica, sans-serif" size="1">ZIP/Postal
        Code</font></b></td>
      <td width="164" bgcolor="#FF0000">
        <input type="text" name="zip_code">
      </td>
      <td width="266">&nbsp;</td>
    </tr>
    <tr> 
      <td width="156" bgcolor="#FF0000"><b><font face="Verdana, Arial,
Helvetica, sans-serif" size="1">Country</font></b></td>
      <td width="164" bgcolor="#FF0000">
        <select name="country" size="1">
          <option selected>Select One</option>
          <option value="CA">Canada </option>
          <option value="FR">France </option>
          <option value="DE">Germany </option>
          <option value="IT">Italy </option>
          <option value="JP">Japan </option>
          <option value="RU">Russia </option>
          <option value="UK">United Kingdom </option>
          <option value="US">United States </option>
          <option>- - - -</option>
          <option value="AF">Afghanistan </option>
          <option value="AL">Albania </option>
          <option value="DZ">Algeria </option>
          <option value="AS">American Samoa </option>
          <option value="AD">Andorra </option>
          <option value="AO">Angola </option>
          <option value="AI">Anguilla </option>
          <option value="AQ">Antarctica </option>
          <option value="AG">Antigua And Barbuda </option>
          <option value="AR">Argentina </option>
          <option value="AM">Armenia </option>
          <option value="AW">Aruba </option>
          <option value="AU">Australia </option>
          <option value="AT">Austria </option>
          <option value="AZ">Azerbaijan </option>
          <option value="BS">Bahamas, The </option>
          <option value="BH">Bahrain </option>
          <option value="BD">Bangladesh </option>
          <option value="BB">Barbados </option>
          <option value="BY">Belarus </option>
          <option value="BE">Belgium </option>
          <option value="BZ">Belize </option>
          <option value="BJ">Benin </option>
          <option value="BM">Bermuda </option>
          <option value="BT">Bhutan </option>
          <option value="BO">Bolivia </option>
          <option value="BA">Bosnia and Herzegovina </option>
          <option value="BW">Botswana </option>
          <option value="BV">Bouvet Island </option>
          <option value="BR">Brazil </option>
          <option value="IO">British Indian Ocean Terr. </option>
          <option value="BN">Brunei </option>
          <option value="BG">Bulgaria </option>
          <option value="BF">Burkina Faso </option>
          <option value="BI">Burundi </option>
          <option value="KH">Cambodia </option>
          <option value="CM">Cameroon </option>
          <option value="CV">Cape Verde </option>
          <option value="KY">Cayman Islands </option>
          <option value="CF">Central African Republic </option>
          <option value="TD">Chad </option>
          <option value="CL">Chile </option>
          <option value="CN">China </option>
          <option value="CX">Christmas Island </option>
          <option value="CC">Cocos (Keeling) Islands </option>
          <option value="CO">Colombia </option>
          <option value="KM">Comoros </option>
          <option value="CG">Congo </option>
          <option value="CD">Congo, Dem. Rep</option>
          <option value="CK">Cook Islands </option>
          <option value="CR">Costa Rica </option>
          <option value="CI">Cote D'Ivoire (Ivory Coast) </option>
          <option value="HR">Croatia (Hrvatska) </option>
          <option value="CU">Cuba </option>
          <option value="CY">Cyprus </option>
          <option value="CZ">Czech Republic </option>
          <option value="DK">Denmark </option>
          <option value="DJ">Djibouti </option>
          <option value="DM">Dominica </option>
          <option value="DO">Dominican Republic </option>
          <option value="TP">East Timor </option>
          <option value="EC">Ecuador </option>
          <option value="EG">Egypt </option>
          <option value="SV">El Salvador </option>
          <option value="GQ">Equatorial Guinea </option>
          <option value="ER">Eritrea </option>
          <option value="EE">Estonia </option>
          <option value="ET">Ethiopia </option>
          <option value="FK">Falkland Islands </option>
          <option value="FO">Faroe Islands </option>
          <option value="FJ">Fiji Islands </option>
          <option value="FI">Finland </option>
          <option value="GF">French Guiana </option>
          <option value="PF">French Polynesia </option>
          <option value="TF">French Southern Terr. </option>
          <option value="GA">Gabon </option>
          <option value="GM">Gambia</option>
          <option value="GE">Georgia </option>
          <option value="GH">Ghana </option>
          <option value="GI">Gibraltar </option>
          <option value="GR">Greece </option>
          <option value="GL">Greenland </option>
          <option value="GD">Grenada </option>
          <option value="GP">Guadeloupe </option>
          <option value="GU">Guam </option>
          <option value="GT">Guatemala </option>
          <option value="GN">Guinea </option>
          <option value="GW">Guinea-Bissau </option>
          <option value="GY">Guyana </option>
          <option value="HT">Haiti </option>
          <option value="HM">Heard & McDonald Islands </option>
          <option value="HN">Honduras </option>
          <option value="HK">Hong Kong S.A.R. </option>
          <option value="HU">Hungary </option>
          <option value="IS">Iceland </option>
          <option value="IN">India </option>
          <option value="ID">Indonesia </option>
          <option value="IR">Iran </option>
          <option value="IQ">Iraq </option>
          <option value="IE">Ireland </option>
          <option value="IL">Israel </option>
          <option value="JM">Jamaica </option>
          <option value="JO">Jordan </option>
          <option value="KZ">Kazakhstan </option>
          <option value="KE">Kenya </option>
          <option value="KI">Kiribati </option>
          <option value="KR">Korea </option>
          <option value="KP">Korea, North </option>
          <option value="KW">Kuwait </option>
          <option value="KG">Kyrgyzstan </option>
          <option value="LA">Laos </option>
          <option value="LV">Latvia </option>
          <option value="LB">Lebanon </option>
          <option value="LS">Lesotho </option>
          <option value="LR">Liberia </option>
          <option value="LY">Libya </option>
          <option value="LI">Liechtenstein </option>
          <option value="LT">Lithuania </option>
          <option value="LU">Luxembourg </option>
          <option value="MO">Macau S.A.R. </option>
          <option value="MK">Macedonia </option>
          <option value="MG">Madagascar </option>
          <option value="MW">Malawi </option>
          <option value="MY">Malaysia </option>
          <option value="MV">Maldives </option>
          <option value="ML">Mali </option>
          <option value="MT">Malta </option>
          <option value="MH">Marshall Islands </option>
          <option value="MQ">Martinique </option>
          <option value="MR">Mauritania </option>
          <option value="MU">Mauritius </option>
          <option value="YT">Mayotte </option>
          <option value="MX">Mexico </option>
          <option value="FM">Micronesia </option>
          <option value="MD">Moldova </option>
          <option value="MC">Monaco </option>
          <option value="MN">Mongolia </option>
          <option value="MS">Montserrat </option>
          <option value="MA">Morocco </option>
          <option value="MZ">Mozambique </option>
          <option value="MM">Myanmar </option>
          <option value="NA">Namibia </option>
          <option value="NR">Nauru </option>
          <option value="NP">Nepal </option>
          <option value="AN">Netherlands Antilles </option>
          <option value="NL">Netherlands </option>
          <option value="NC">New Caledonia </option>
          <option value="NZ">New Zealand </option>
          <option value="NI">Nicaragua </option>
          <option value="NE">Niger </option>
          <option value="NG">Nigeria </option>
          <option value="NU">Niue </option>
          <option value="NF">Norfolk Island </option>
          <option value="MP">Northern Mariana Islands </option>
          <option value="NO">Norway </option>
          <option value="OM">Oman </option>
          <option value="PK">Pakistan </option>
          <option value="PW">Palau </option>
          <option value="PA">Panama </option>
          <option value="PG">Papua New Guinea </option>
          <option value="PY">Paraguay </option>
          <option value="PE">Peru </option>
          <option value="PH">Philippines </option>
          <option value="PN">Pitcairn Island </option>
          <option value="PL">Poland </option>
          <option value="PT">Portugal </option>
          <option value="PR">Puerto Rico </option>
          <option value="QA">Qatar </option>
          <option value="RE">Reunion </option>
          <option value="RO">Romania </option>
          <option value="RW">Rwanda </option>
          <option value="SH">Saint Helena </option>
          <option value="KN">Saint Kitts & Nevis </option>
          <option value="LC">Saint Lucia </option>
          <option value="PM">Saint Pierre & Miquelon </option>
          <option value="VC">Saint Vincent & Grenadines </option>
          <option value="WS">Samoa </option>
          <option value="SM">San Marino </option>
          <option value="ST">Sao Tome & Principe </option>
          <option value="SA">Saudi Arabia </option>
          <option value="SN">Senegal </option>
          <option value="SC">Seychelles </option>
          <option value="SL">Sierra Leone </option>
          <option value="SG">Singapore </option>
          <option value="SK">Slovakia </option>
          <option value="SI">Slovenia </option>
          <option value="SB">Solomon Islands </option>
          <option value="SO">Somalia </option>
          <option value="ZA">South Africa </option>
          <option value="GS">South Georgia/South Sandwich Is.</option>
          <option value="ES">Spain </option>
          <option value="LK">Sri Lanka </option>
          <option value="SD">Sudan </option>
          <option value="SR">Suriname </option>
          <option value="SJ">Svalbard & Jan Mayen Is. </option>
          <option value="SZ">Swaziland </option>
          <option value="SE">Sweden </option>
          <option value="CH">Switzerland </option>
          <option value="SY">Syria </option>
          <option value="TW">Taiwan </option>
          <option value="TJ">Tajikistan </option>
          <option value="TZ">Tanzania </option>
          <option value="TH">Thailand </option>
          <option value="TG">Togo </option>
          <option value="TK">Tokelau </option>
          <option value="TO">Tonga </option>
          <option value="TT">Trinidad & Tobago </option>
          <option value="TN">Tunisia </option>
          <option value="TR">Turkey </option>
          <option value="TM">Turkmenistan </option>
          <option value="TC">Turks & Caicos Is. </option>
          <option value="TV">Tuvalu </option>
          <option value="UG">Uganda </option>
          <option value="UA">Ukraine </option>
          <option value="AE">United Arab Emirates </option>
          <option value="UM">U.S. Minor Outlying Islands </option>
          <option value="UY">Uruguay </option>
          <option value="UZ">Uzbekistan </option>
          <option value="VU">Vanuatu </option>
          <option value="VA">Vatican City </option>
          <option value="VE">Venezuela </option>
          <option value="VN">Vietnam </option>
          <option value="VG">Virgin Islands (UK) </option>
          <option value="VI">Virgin Islands (US) </option>
          <option value="WF">Wallis & Futuna Is. </option>
          <option value="YE">Yemen </option>
          <option value="YU">Yugoslavia </option>
          <option value="ZM">Zambia </option>
          <option value="ZW">Zimbabwe </option>
        </select>
      </td>
      <td width="266">&nbsp;</td>
    </tr>
    <tr> 
      <td width="156" bgcolor="#FF0000"><b><font face="Verdana, Arial,
Helvetica, sans-serif" size="1">Email</font></b></td>
      <td width="164" bgcolor="#FF0000">
        <input type="text" name="email" MAXLENGTH="60">
      </td>
      <td width="266">&nbsp;</td>
    </tr>
    <tr> 
      <td width="156"><b><font face="Verdana, Arial, Helvetica, sans-serif"
size="1">eCommerce 
        URL</font></b></td>
      <td width="164">
        <input type="text" name="ecommerce_url" MAXLENGTH="100">
      </td>
      <td width="266">&nbsp;</td>
    </tr>
    <tr> 
      <td width="156"><b><font face="Verdana, Arial, Helvetica, sans-serif"
size="1">Band 
        Home Page URL</font></b></td>
      <td width="164">
        <input type="text" name="band_url" MAXLENGTH="100">
      </td>
      <td width="266">&nbsp;</td>
    </tr>
    <tr> 
      <td width="156" bgcolor="#FF0000"><b><font face="Verdana, Arial,
Helvetica, sans-serif" size="1">Password</font></b></td>
      <td width="164" bgcolor="#FF0000">
        <input type="password" name="password_1" MAXLENGTH="13">
      </td>
      <td width="266">&nbsp;</td>
    </tr>
    <tr> 
      <td width="156" bgcolor="#FF0000"><b><font face="Verdana, Arial,
Helvetica, sans-serif" size="1">Password
        Again</font></b></td>
      <td width="164" bgcolor="#FF0000">
        <input type="password" name="password_2" MAXLENGTH="13">
      </td>
      <td width="266">&nbsp;</td>
    </tr>
    <tr> 
      <td width="156"><b><font face="Verdana, Arial, Helvetica, sans-serif"
size="1">Financial 
        Information</font></b></td>
      <td width="164">&nbsp;</td>
      <td width="266">&nbsp;</td>
    </tr>
    <tr> 
      <td width="156" bgcolor="#FF0000"><b><font face="Verdana, Arial,
Helvetica, sans-serif" size="1">Social
        Security Number or Tax ID Number<br>
        </font></b></td>
      <td width="164" bgcolor="#FF0000">
        <input type="text" name="tax_id" MAXLENGTH="30">
      </td>
      <td width="266">&nbsp;</td>
    </tr>
    <tr> 
      <td width="156" bgcolor="#FFFFFF">&nbsp;</td>
      <td width="164" bgcolor="#FFFFFF">&nbsp;</td>
      <td width="266">&nbsp;</td>
    </tr>
    <tr> 
      <td width="156" bgcolor="#FFFFFF">&nbsp;</td>
      <td width="164" bgcolor="#FFFFFF">&nbsp;</td>
      <td width="266">&nbsp;</td>
    </tr>
    <tr>
      <td width="156" bgcolor="#FFFFFF" align="left" valign="top"><font
face="Verdana, Arial, Helvetica, sans-serif" size="1"><b>BIO</b><br>
        Enter a small biography for your band.</font></td>
      <td width="164" bgcolor="#FFFFFF">
        <textarea name="band_bio" cols="35" rows="20"></textarea>
      </td>
      <td width="266">&nbsp;</td>
    </tr>
    <tr> 
      <td width="156" bgcolor="#FFFFFF">&nbsp;</td>
      <td width="164" bgcolor="#FFFFFF">&nbsp;</td>
      <td width="266">&nbsp;</td>
    </tr>
    <tr> 
      <td width="156" bgcolor="#FFFFFF"><font face="Verdana, Arial,
Helvetica, sans-serif" size="2"><b>Awards</b><font size="1"><br>
        Have you or any member of your band ever won a gold or platinum
record?</font></font></td>
      <td width="164" bgcolor="#FFFFFF" align="left" valign="top">
        <input type="checkbox" name="gold_record" value="checkbox">
        <font face="Verdana, Arial, Helvetica, sans-serif"> <font
size="2">Yes</font></font></td>
      <td width="266">&nbsp;</td>
    </tr>
  </table>
  <br>
  <p>
    <input type="RESET" name="RESET" value="Reset">
    <br><br>
    <input type="submit" name="submit_band" value="Submit">
  </p>
<INPUT TYPE="hidden" NAME="_wss" VALUE="1"></form>
<p>&nbsp;</p>
<p>&nbsp;</p>
</body>
</html>


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to