View Single Post
Old 07-21-2011, 12:12 PM   PM User | #2
butlins
Regular Coder

 
Join Date: Aug 2006
Location: Cardiff, UK
Posts: 141
Thanks: 15
Thanked 2 Times in 2 Posts
butlins is an unknown quantity at this point
Okay - thought I'd try answering my own question about the repeated [] making the ids invalid and put numbers in there, which I can insert on my final from using a loop at run-time. So now my test form looks like this:
Code:
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Untitled Document</title>
</head>
<body>
<form action="insert1.php" method="post">
  <table>
    <caption>Test form to check multiple insert:</caption>
    <tr>
      <th>Mailing List Name ID</th>
      <th>Exhibition ID</th>
      <th>Client ID</th>
      <th>Send card</th>
    </tr>
    <tr>
      <td><input type="text" name="mailinglistnameID[1]" id="mailinglistnameID[1]" /></td>
      <td><input type="text" name="locationID[1]" id="locationID[1]" /></td>
      <td><input type="text" name="clientID[1]" id="clientID[1]" /></td>
      <td><input type="checkbox" name="isCard[1]" id="isCard[1]" value="1" /></td>
    </tr>
    <tr>
      <td><input type="text" name="mailinglistnameID[2]" id="mailinglistnameID[2]" /></td>
      <td><input type="text" name="locationID[2]" id="locationID[2]" /></td>
      <td><input type="text" name="clientID[2]" id="clientID[2]" /></td>
      <td><input type="checkbox" name="isCard[2]" id="isCard[2]" value="1" /></td>
    </tr>
    <tr>
      <td><input type="text" name="mailinglistnameID[3]" id="mailinglistnameID[3]" /></td>
      <td><input type="text" name="locationID[3]" id="locationID[3]" /></td>
      <td><input type="text" name="clientID[3]" id="clientID[3]" /></td>
      <td><input type="checkbox" name="isCard[3]" id="isCard[3]" value="1" /></td>
    </tr>
  </table>
  <p>
    <input type="submit" name="Submit" id="Submit" value="Submit" />
  </p>
</form>
</body>
</html>
And the isCard boolean is now being uploaded correctly, but it's still only inserting the final row, so there's got to be a problem in how I'm constructing my array.
__________________
If anyone asks my boss, this counts as work, okay?
butlins is offline   Reply With Quote