views:

260

answers:

1

I am using this plugin: http://jquery.bassistance.de/autocomplete/demo/

I have an autocomplete textarea where the values are autocompleted and are separated by commas.

This textarea is inside a form. When I submit this form, I expect the values to be transmitted to the serverside which is the action of my form. However, I am not getting any values back.

How can I fix that?

Here is my code:

jQuery autocomplete code:

jQueryTest("#newImages").autocomplete("images.php", {
 width: 320,
 max: 3,
 highlight: false,
 scroll: true,
 scrollHeight: 200,
 multiple: true,    
 formatItem: function(data, i, n, value) {
  return "<img height='72' width='72' src='/catalogFiles/" + 
        value + ".jpg'/> " + value.split(".")[0];
 },
 formatResult: function(data, value) {
  return value.split(".")[0];
 },
});

Html:

<form method="post" action="<?= $_SERVER['PHP_SELF'] ?>">   
   <td style="padding-right: 25px;">New Images:</td>
   <td><textarea class="inputmeat" name="newImages_name" rows="3" cols="60" 
     id="newImages"></textarea></td>
   <td style="padding-right: 25px;"></td>
   <td><input type="submit" name="cmd" value="Update" /></td>
</form>

PHP Code when submit is clicked:

<?php
$cmd=$_POST["cmd"]; 
if(isset($cmd)) {
     $newImagesName = mysql_escape_string( $_POST["newImages_name"]);   
     echo $newImageName;  
}
?>
A: 

It looks like you have a typo, either in your code or on this page?

$newImagesName = mysql_escape_string( $_POST["newImages_name"]);   
echo $newImageName;

Note, newImagesName vs. newImageName.

Funka
:( I guess its time for me to call it a night. thanks for pointing tha tout for me!
josh