Jump to content

SF23103

Members
  • Posts

    100
  • Joined

  • Last visited

Community Answers

  1. SF23103's post in clone set of form fields and append number to name based on variable was marked as the answer   
    Thanks for catching my label error and for the suggestion.  I ended up doing this:
    <?php $counter = 0; for ($x = 1; $x <= 5; $x++) { $counter++; echo "Student " . $counter . ":"; echo "<div class=\"form_fields_enthusiast\"> <p><label for=\"Name\">Name:</label> <input name=\"First_Name_" . $counter . "\" type=\"text\" value=\"\" size=\"16\" maxlength=\"35\" placeholder=\"First\"/> <input name=\"Middle_Name_" . $counter . "\" type=\"text\" value=\"\" size=\"16\" maxlength=\"35\" placeholder=\"Middle\"/> <input name=\"Last_Name_" . $counter . "\" type=\"text\" value=\"\" size=\"16\" maxlength=\"35\" placeholder=\"Last\"/><span style=\"font-size:11px\">(Required)</span></p> <div style=\"display:none\"> <input type=\"text\" name=\"email_address_" . $counter . "\" value=\"\" /> </div> <p><label for=\"address_" . $counter . "\">Address:</label> <input name=\"Address_" . $counter . "\" type=\"text\" value=\"\" size=\"25\" maxlength=\"35\" placeholder=\"123 Main Street\"/> <input name=\"apt_" . $counter . "\" type=\"text\" value=\"\" size=\"4\" maxlength=\"5\" placeholder=\"APT\"/><span style=\"font-size:11px\">(Required)</span></label></p> <p><label for=\"City_" . $counter . "\">City:</label> <input name=\"City\" type=\"text\" value=\"\" size=\"16\" maxlength=\"35\" placeholder=\"San Francisco\"/> State: <input name=\"State\" type=\"text\" value=\"\" size=\"3\" maxlength=\"10\" placeholder=\"CA\"/> ZIP:<input name=\"Zip_" . $counter . "\" type=\"text\" value=\"\" size=\"10\" maxlength=\"10\" placeholder=\"94574\" /><span style=\"font-size:11px\">(Required)</span></label></p> <p><label for=\"home_phone_" . $counter . "\">Home Phone:</label> <input name=\"home_phone_" . $counter . "\" type=\"text\" value=\"\" size=\"16\" maxlength=\"18\" placeholder=\"555-555-5555\" /><span style=\"font-size:11px\">(Required)</span></label></p> <p><label for=\"cell_phone_" . $counter . "\">Cell Phone:</label> <input name=\"cell_phone_" . $counter . "\" type=\"text\" value=\"\" size=\"16\" maxlength=\"18\" placeholder=\"555-555-5555\" /><span style=\"font-size:11px\"></span></label></p> <p><label for=\"email_" . $counter . "\">Email:</label><input name=\"email\" type=\"text\" value=\"\" size=\"30\" maxlength=\"40\" placeholder=\"you@gmail.com\" /><span style=\"font-size:11px\">(Required)</span></label></p> <p><label for=\"birthday_" . $counter . "\">Date of Birth:</label> <input name=\"birthday\" type=\"text\" value=\"\" size=\"16\" maxlength=\"10\" placeholder=\"MM/DD/YYYY\" /><span style=\"font-size:11px\">(Required)</span></label></p> <p><label for=\"student_id_" . $counter . "\">Student ID#:</label> <input name=\"student_id_" . $counter . "\" type=\"text\" value=\"\" size=\"16\" maxlength=\"16\" placeholder=\"\" /></label></p> </div>"; } ?>
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.