1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

Post vars and Array Together

Discussion in 'PHP' started by bkflash, Dec 20, 2006.

  1. #1
    Iam having this problem andi ill try to explain it the best i can.

    
    $query = mysql_query("SELECT * FROM $db[users_home_options] WHERE option_id = '$id'",$db[link]);
    
    $image = mysql_fetch_array($query);
    
    <form method="post" enctype="multipart/form-data" action="" >
      Select a Image Slot:
      <select name="slot">
        <option value="image1" selected="selected">Slot 1</option>
        <option value="image2">Slot 2</option>
        <option value="image3">Slot 3</option>
        <option value="image4">Slot 4</option>
        <option value="image5">Slot 5</option>
      </select>
      <strong>Please Upload an Image of the Property</strong> <br />
      Image of Property:
      <input type="file" name="userfile">
      <br />
      <input type="submit" name="Submit" value="Confirm &amp; Save">
    </form>
    
    
    $slot=$_POST[slot];
    
    $filepath = "img/".$image[$slot];
    	
    	if (! unlink ($filepath)) {
       echo ("Couldn't delete file");
    } else {
        echo ("Removed $filepath");
    }
    
    
    Code (markup):
    theres what i have so far, not to hard to follow, but i can't get the $image[$slot] to display, it won't retrieve the data, what am i doing wrong, i have tested $image[$slot] with other variables and it works.

    I left out alot of the code because it would seem alittle confusing on here. any help would be great thanks.
     
    bkflash, Dec 20, 2006 IP
  2. void

    void Peon

    Messages:
    119
    Likes Received:
    9
    Best Answers:
    0
    Trophy Points:
    0
    #2
    $slot=$_POST['slot'];
     
    void, Dec 20, 2006 IP
  3. bkflash

    bkflash Peon

    Messages:
    27
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    ya that did it, thanks
     
    bkflash, Dec 20, 2006 IP