adand 0 Newbie Poster

I am having a problem sending my form to MySQL on my application page (when you click GameTime! it should send the data to a MySQL table.)- http://www.facebook.com/apps/applicatio … 6347603790

It sends the form data here: http://bit.ly/91oi88 however, it just won't seem to work in facebook. Obviously there is something wrong with my FBML/FBJS.

I've posted some code below:

<!--THIS IS WHERE I STARTED THE USER'S PICKS-->
            <FORM METHOD="POST" ACTION="index.php" NAME="submitChoice">
            <INPUT TYPE="HIDDEN" ID="image0" NAME="image0" VALUE="none">
            <INPUT TYPE="HIDDEN" ID="image1" NAME="image1" VALUE="none">
            <INPUT TYPE="HIDDEN" ID="image2" NAME="image2" VALUE="none">
            <INPUT TYPE="HIDDEN" ID="image3" NAME="image3" VALUE="none">
            <INPUT TYPE="HIDDEN" ID="image4" NAME="image4" VALUE="none">
        </FORM>
        <!--END THE USER'S PICKS-->

This is the FBJS where I call the function:

function getPicks(){
           var j;
        for(j=0; j<5; j++){
                
                var div=document.getElementById("li"+j);
                var image=div.childNodes[1];
                var imageID=image.getAttribute("id");
                var hiddenfield=document.getElementById("image"+j);
                hiddenfield.value=imageID;
                }
               
      }
      function gameTime(){
          getPicks();
          document.forms["submitChoice"].submit();
          publishWall();    
  }

And this is my PHP code at the beginning of the doc.

<?php
$site_url = "xxxx";
$fb_page_url = "xxxx";
$numslides = 16;
$slidesvisible = 5;
$currentslide = 0;
$slidewidth = 95;
if (isset($_POST['image0'])) {
$image1=$_POST['image0'];
$image2=$_POST['image1'];
$image3=$_POST['image2'];
$image4=$_POST['image3'];
$image5=$_POST['image4'];
$imageArray=array($image1, $image2, $image3, $image4, $image5);
mysql_connect('xxxx','xxx','xx');
mysql_select_db('xxx');
$tablename="player_picks";
$sql="SELECT MAX(pick_ID) as pickID FROM $tablename";
$result=mysql_query($sql);
if($result){
$row=mysql_fetch_assoc($result);
if(is_null($row['pickID'])) {
$pick_ID=1;
}
else {
$pick_ID=intval($row['pickID'])+1;
}
}
for($i=0; $i<count($imageArray); $i++) {
$sql="INSERT INTO $tablename (pick_ID, pickImage) VALUES ($pick_ID, '".$imageArray[$i]."')";
$result=mysql_query($sql);
}
}
?>

Can anyone tell me what I am doing wrong?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.