title: I need to post a static path to an image in mysql
body: <p>My title may be a bit confusing so let me try to explain in detail, I have a form for a youth football league that requires the user to select their team from a drop down box, when they select their team it will change the logo on the form to their team logo. What I need to do is post the path to the logo in mysql and have the logo display on the results page. My problem is I can't figure out how to get the logo path to post in mysql. Here is a <a href="http://jsfiddle.net/UtcTc/" rel="nofollow">jsfiddle</a> of my form to change the logo.</p>
  
  <p>here is the html:</p>
  
  <pre><code>&lt;body style="height: 449px; width: 933px;"&gt;
  &lt;form method="post" action="process_rentals.php" enctype="multipart/form-data"&gt;
  &lt;div id="container" class="auto-style5" style="height: 234px"&gt;
  &lt;br&gt;
  &lt;div class="auto-style1" style="height: 168px"&gt;
  
  &lt;img name="logo_image" id="logoimage"  style="float: left" width="175" height="175"/&gt;
  
  &lt;br/&gt;&lt;br/&gt;
  
  &lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;
  
  &lt;select name="team_name" id="dd" onChange="swapImage()" style="width: 150px"&gt;
  &lt;option value=""&gt;&lt;/option&gt;
  &lt;option value="FALCONS" title="decals/falcons2013.jpg" &gt;Falcons&lt;/option&gt;
  &lt;option value="GREEN VALLEY KNIGHTS" title="decals/gvklogo2013.png"&gt;Green Valley Knights&lt;/option&gt;
  &lt;option value="LONGHORNS" title="decals/longhorns2013.jpg"&gt;Longhorns&lt;/option&gt;
  &lt;option value="MUSTANGS" title="decals/mustangs2013.jpg"&gt;Mustangs&lt;/option&gt;
  &lt;option value="NW NINERS" title="decals/nwniners2013.jpg"&gt;NW Niners&lt;/option&gt;
  &lt;option value="REBELS" title="decals/rebels2013.jpg"&gt;Rebels&lt;/option&gt;
  &lt;option value="WILDCATS" title="decals/wildcats2013.jpg"&gt;Wildcats&lt;/option&gt;
  
  &lt;/select&gt;
  
  &lt;/div&gt;
  </code></pre>
  
  <p>
  and the javascript:</p>
  
  <pre><code>function swapImage(){
  var image = document.getElementById("logoimage");
  var dropd = document.getElementById("dd");
  image.src = dropd.options[dropd.selectedIndex].title;   
  };
  </code></pre>
  
  <p>Is there a way to say, if the title value=MUSTANGS then display the image at this path?
  so if the title is mustangs then display the image at decals/images/mustangs2013.jpg or is there a simpler way of getting the image path in mysql?
  My form works, all the data posts to mysql I just can't get the logo to display because I can't figure out how to tell it where it is at.</p>
  
  <pre><code>    &lt;?php
  //----------PATH OF UPLOADED IMAGE----------//
  $target = "uploads/images/logos/";
  $target = $target . basename($_FILES['logo_image']['name']);
  
  //----------FORM INFO----------//
  $team_name=$_POST['team_name'];
  $player_name=$_POST['player_name'];
  $chinstrap_number=$_POST['chinstrap_number'];
  $shoulderpad_number=$_POST['shoulderpad_number'];
  $parent_signature=$_POST['parent_signature'];
  $print_name=$_POST['print_name'];
  $date=$_POST['date'];
  $pic=($_FILES['logo_image']['name']);
  
  //----------CONNECT TO DATABASE----------//
  include 'elite_connect.php';
  
  //----------WRITES TO DATABASE----------//
  mysql_query("INSERT INTO rentals (date, team_name, player_name, chinstrap_number, shoulderpad_number, parent_signature, print_name, logo_image)
  VALUES ('$date','$team_name','$player_name','$chinstrap_number','$shoulderpad_number','$parent_signature','$print_name','$target')");
  echo mysql_error();
  
  //----------WRITES LOGO TO SERVER----------//
  //if(move_uploaded_file($_FILES['logo_image']['tmp_name'], $target))
  //{//----------TELLS IF ALL IS OK----------//
  //echo "The file ". basename($_FILES['logo_image']['name']). " has been uploaded!";
  //}
  //else{
  //----------GIVES AN ERROR IF IT'S NOT----------//
  //echo "Sorry, there was a problem uploading your file.";
  //}
  ?&gt;
  &lt;html&gt;
  &lt;body&gt;
  &lt;center&gt;
  &lt;form name="rental_results" method="post" action="rental_results.php" enctype="multipart/form-data" id="rentalresults"&gt;
  &lt;input type="submit" name="submit" id="submit" value="Display Form"/&gt;
  &lt;input type="submit" name="newform" id="newform" value="New Rental"/&gt;
  &lt;/form&gt;
  &lt;/center&gt;&lt;/body&gt;&lt;/html&gt;
  </code></pre>
  
  <p>so the greyed out section of code i'm not using as it requires a file selection to upload the image to a folder and inserts the path to the file in the database, the code works just not with how the images are being used on this form.</p>