Dear all
I am a beginner in web development. Please help to resolve the below problem. Right now I am creating a Workers Directory with sql database.
This is including worker name, Location, Work and mobile numbers.

When customer select the specific job we need to filter particular job from available location and while click on location from second page show only the specific workers from that same location

This is the my First page Index.php

<?php require('config1.php');  ?>
<!doctype html>
<html class="no-js" lang="en-US">
    <title> Info - </title>      
<div data-role="page" id="home" data-theme="c">

    <div data-role="content">

    <div id="branding">
        <h1> Info</h1>

    <div class="choice_list"> 
    <h1> What are you looking? </h1>

    <ul data-role="listview" data-inset="true" data-filter="true">
    <li><a href="choose_town.php" data-transition="slidedown"> <img src="images/ac_technician.jpg"/> <h3>AC Technician</h3></a></li>
    <li><a href="choose_town.php" data-transition="slidedown"> <img src="images/beautician.jpg"/> <h3>Beautician.jpg</h3></a></li>
        <li><a href="choose_town.php" data-transition="slidedown"> <img src="images/cricket_umpire.jpg"/> <h3>Cricket Umpire</h3></a></li>
    <li><a href="choose_town.php" data-transition="slidedown"> <img src="images/carpenter.jpg"/> <h3>Carpenters </h3></a></li>

</div><!-- /page -->



My Second Page choose_town.php

// Check connection
if (mysqli_connect_errno())
echo "Failed to connect to MySQL: " . mysqli_connect_error();

$result = mysqli_query($con,"SELECT DISTINCT location FROM nilambur_info  ");

while($row = mysqli_fetch_array($result))
echo "<ul class='ui-listview ui-listview-inset ui-corner-all ui-shadow';  >";
echo "<li data-theme='c'; class='ui-btn ui-btn-icon-right ui-li-has-arrow ui-li ui-li-has-count ui-btn-up-c';><div class='ui-btn-inner ui-li';><div class='ui-btn-text';><a href='choose_worker.php'; data-transition='slidedown'; class='ui-link-inherit';> " . $row['location'] . "<span class='ui-li-count ui-btn-up-c ui-btn-corner-all';>2 </span></a> </div><span class='ui-icon ui-icon-arrow-r ui-icon-shadow'></span></div></li>";
echo "</ul>";



My third page choose_worker.php

<?php require('config1.php'); ?>



$query=mysql_query("select id, first_name, last_name, mobile1, mobile2 from nilambur_info ORDER BY id DESC LIMIT $start, $limit");

echo '<li><a href="contact.php?id='.$row['id'].'" data-transition="slidedown"><img src="images/calling.png"/><h2>'.$row['first_name'].' '.$row['last_name'].'</h2><p>Mobile : '.$row['mobile1'].'  ,  '.$row['mobile2'].'</p></a></li>';

$rows=mysql_num_rows(mysql_query("SELECT id, first_name, last_name, mobile1 FROM nilambur_info"));

echo "<a href='?id=".($id-1)."' class='button'>PREVIOUS</a>";
echo "<a href='?id=".($id+1)."' class='button'>NEXT</a>";

echo "<ul class='page'>";
if($i==$id) { echo "<li class='current'>".$i."</li>"; }

else { echo "<li><a href='?id=".$i."'>".$i."</a></li>"; }
echo "</ul>";

forth page contact.php

<?php require('config1.php'); 

$stmt = $db->prepare('SELECT id, first_name, last_name, mobile1, mobile2, land_line, address, location, job FROM nilambur_info WHERE id = :id');
$stmt->execute(array(':id' => $_GET['id']));
$row = $stmt->fetch();
$query = $_SERVER['QUERY_STRING'];

//if post does not exists redirect user.
if($row['id'] == ''){
    header('Location: ./');


        echo '<div data-role="content">';
    echo '<div class="ui-grid-a" id="restau_infos">';
    echo '  <div class="ui-block-a">';
    echo '  <h1>'.$row['first_name'].'  '.$row['last_name'].'</h1>';
    echo '  <p><strong>'.$row['job'].'</strong></p>';
    echo '  <p> Contact Details </p>';
    echo '      <ul> ';
    echo '          <li> Mobile:'.$row['mobile1'].'</li>';
    echo '          <li> Whatsapp :'.$row['mobile2'].'</li>';
    echo '          <li> Land Phone or Email : '.$row['land_line'].'</li>';
    echo '      </ul>   ';      
    echo '  </div>  ';  
    echo '  <div class="ui-block-b">';
    echo '  </div>';
    echo '</div>';

    echo '<!-- /grid-a -->';
    echo '<hr/>';

    echo '<div class="ui-grid-a" id="contact_infos">';  
    echo '  <div class="ui-block-a">';
    echo '  <h2> Contact us</h2>';
    echo '  <p>'.$row['address'].'</p>';
    echo '  <p>'.$row['location'].'</p>';       
    echo '  </div>      ';
    echo '  <div class="ui-block-b">';
    echo '  </div>';
    echo '</div><!-- /grid-a -->';

    echo '<div id="contact_buttons">';  
    echo '  <a href="tel:'.$row['mobile1'].'" data-role="button" data-icon="tel"> Call us</a> ';    

    echo '  <a href="choose_worker.php"  data-role="button" data-transition="slideup" > Back</a>';
    echo '  <a href="index.php"  data-role="button" data-transition="slideup" > Back to Home </a>';

    echo '</div>    ';
    echo '<hr/>';


Edited by Faisal_13

1 Year
Discussion Span
Last Post by Faisal_13

What is your exact problem? You need to pass your selection to the next page and change your query to filter based on your selection.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.