Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Passing a simple parameter
  • Good morning all!

    Quick question. So I am implementing a system to upload a picture of a restaurant, and assign that picture to that restaurant in my DB. so far so good, but I am having trouble retrieving the id of the restaurant.

    here is my HTML code:
    <?php $restaurantId = $_POST['id'];?>
    a href="javascript:jQuery('#uploadifyRestaurant').uploadifyUpload()">img src="Images/upload.png"


    and my script code;
    $(document).ready(function() {
    $("#uploadifyRestaurant").uploadify
    ({
    'uploader' : 'scripts/uploadify.swf',
    'script' : 'scripts/uploadify.php',
    'cancelImg' : 'Images/cancel.png',
    'folder' : 'uploads',
    'multi' : false,
    'onAllComplete' : function(event, data)
    { },
    'onComplete': function(event, queueID, fileObj, response, data)
    {
    $test = "pictures/restaurantpictureupload.php/?fileName=" + fileObj.name;
    window.location.replace($test);
    }
    });
    });

    So I would like to pass in my HTML code the $restaurantId parameter, and on my onComplete I would use it to pass it in my URL.

    Is it possible, and if so, how?

    Thanks!
  • Use something liek this:

    $(document).ready(function() {
    $("#uploadifyRestaurant").uploadify
    ({
    'uploader' : 'scripts/uploadify.swf',
    'script' : 'scripts/uploadify.php',
    'cancelImg' : 'Images/cancel.png',
    'folder' : 'uploads',
    'multi' : false,
    'scriptData' : {'restaurant_id':$restaurantId},
    'onAllComplete' : function(event, data)
    { },
    'onComplete': function(event, queueID, fileObj, response, data)
    {
    $test = "pictures/restaurantpictureupload.php/?fileName=" + fileObj.name;
    window.location.replace($test);
    }
    });
    });
  • The user and all related content has been deleted.