'HTML' form

     <form  action="result.php" method="POST">

  <input type="search" name="query" size="10" id="searchfield" title="searchfield" />
  <input type="submit" name="Search" value="" alt="Search" id="searchbutton" title="Search" />
 </form>

result php file

<?php 
@session_start(); 
include 'connections.php';
if (isset($_POST['query']) && $_POST['query'] != "")


$query = $_POST['query'];

$min_length = 1;
if(strlen($query) >= $min_length)
  {
$query = htmlspecialchars($query);
$query = mysql_real_escape_string($query);
............`

value that entered in search field is not going from 'HTML' form to 'PHP' file to perform required operations please anyone help me to solve this bug..

Recommended Answers

All 4 Replies

It looks okay to me, try var_dump($_POST) on your results.php page to be positive.

I want to point out also, the original mysql functions are now deprecated in PHP and you should be using mysqli or PDO for your database connections.
http://php.net/manual/en/migration55.deprecated.php

Thank you very much for your reply I checked my code as your suggestion.. but it is printing NULL even though I am passing value...

$query = var_dump($_POST['$query']);
echo $query;

and it is printing 'NULL' @pixelsoul

Check the name of the action file.when you post the data it do not find the file name that you given.

action is finding 'result.php' file I checked by placing echo statments....@Sikkander Nasar

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.