hi everyone
can anyone give me a coad for the form of search inside the php i mean they belong in the same page ?

here's my php command for the pagination and results

//Count the total number of row in your table*/
$count_query   = mysql_query("SELECT COUNT(personid) AS numrows FROM persons");
$row     = mysql_fetch_array($count_query);
$numrows = $row['numrows'];
$total_pages = ceil($numrows/$per_page);
$reload = 'index.php';
//main query to fetch the data 
$query = mysql_query("SELECT * FROM persons ORDER by RAND() LIMIT $offset,$per_page");
//loop through fetched data
while($result = mysql_fetch_array($query)){
$id = $result['PersonID'];
echo "<div class= content > ";
echo"<img height=100 width=100 src='upload/". $result['Image'] ."'/>";
echo "<font color='black'>". $result['FirstName']. "</font></br>";
echo "</div>";

i have this query

// basic SQL-injection protection
$searchText = htmlspecialchars ($_POST['searchText']);

// query with simple search criteria
$query = mysql_query("SELECT * FROM persons WHERE FirstName LIKE '%" 
           . $searchText . "%' ORDER by RAND() LIMIT $offset,$per_page");

but i don't have the code for the searchText i get undefined index when i try can someone give me the code for the form it's inside the form

here is the output


can anyone help me just the search part only by the way the code is on ajax when i change page it shows LOADING thanks

i have an error this is my code for the form

<form name='search' method='post' action''>
<input type='text' name='searchtext'>
<input type='submit' name='search' value='search'>

i put it after the include database on the upper side

but its givig me notice undefined index: searchtext

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.