I have an html form which brings up an input box, which is this

<!DOCTYPE html>
<html lang="en">
<head>
<title>Browse</title>
<meta charset="utf-8"/>
<link rel="STYLESHEET" type="text/css" href="../../style/Browse.css">
</head>

<body>

<form>
<form name="input" action="Browsing.php" method="post">
Search <input type="text" name="search" />
<input type="submit" value="Submit" />
</form>
</form>





</body>

</html>

Then I have a php page which handles the input from that html page, the code is this

<?php

      $search= $_POST['search'];
      $con = mysql_connect("localhost","user","pass");
      if (!$con) {
      die('Could not connect: ' . mysql_error());
      }

      mysql_select_db("db", $con); 
      $result = mysql_query("

      SELECT videos.videoname, videos.id_video 
      FROM videos
      WHERE videos.videoname=$search

      "); 


        echo "Videos:";
      while ($row = mysql_fetch_array($result)) {
      $link=$row['videoname'];
      $file_location=$row['id_video'];
      echo "<div id=\"Search_Browse\">";
      echo "<a href='uploads/upload/browseplayer.php?num=$file_location'>$link</a>";
      echo "</div>";
  }

      mysql_close($con);

?>

But it does not display the code onto the page, it just puts ?search=example into the url box

If videos.videoname is a string you should enclose $search in quotes (line 14):

WHERE videos.videoname='$search'

Have you tried to debug the code by inserting echo, die or print_r debug statements like:

// in line 2 to check the value sent over
die($_POST['search']) 

// or between lines 20 and 21 to check the values of row
die(print_r($row, 1)); 

// or between lines 9 and 10 to get the query and paste it to phpmyadmin
die("SELECT videos.videoname, videos.id_video FROM videos WHERE videos.videoname=$search");
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.