Page 2 of 2

Posted: Sun Mar 19, 2006 11:43 pm
by Benjamin
Your on the right track. It looks like your form is returning a multidimensional array. Try removing the [] from the entries field in the form and test it again.

Posted: Sun Mar 19, 2006 11:49 pm
by enigm4_
Problem now gives me:

Warning: Invalid argument supplied for foreach() in /home/dxqmyhvh/public_html/reakt/inner.php(43) : eval()'d code on line 49
string(36) "T-Shirts (available in red or black)"

So it's only grabbing the last selection from the box instad of all of them.

Posted: Mon Mar 20, 2006 2:49 am
by Benjamin

Code: Select all

if(isset($_POST['submit'])) {
  $Entries = $_POST['entries'];
  $Count = count($Entries);

  while ($Count >= 0) {
    $Count--;
    echo $Entries[$Count];
  }

  $story=$_POST['story'];

  //Inset everything into the database
  $compentry=mysql_query("INSERT INTO tblCompetitionSubmissions (compUserID, compStory, compEntries, compEntryDate) VALUES ('$userid', '$story', '$comps', NOW())");

  //Check whether or not the inset worked:
  if($compentry) {
    //If it worked, echo a success
    echo "<div class=\"information\"><h4>Success!</h4><p>Thankyou, your submission has been received.  We will let you know if you win!</p></div>";
  } else {
    //If it failed, show the error:
    echo "<div class=\"phpoutput\"><h4>Error</h4><p>Sorry, your submission could not be sent at this time.  Please try again later, or <a href=\"mailto:online@reakt.com.au\">email Chris</a> to report your problems.</p></div>";
  }
}
That might work, I didn't test it.