Have an account? Sign in
Login  Register  Facebook
Add pagination to my form on wordpress
Hi , i am newbie web designer
i create a php form , and added a in a page template on wordpress
<?php
/** PAGE TEMPLATE **/
/**
 * Template Name: Medical Network - With sidebar
 */
get_header(); ?>
<div id="bannerwrap">
<div id="sliderinner" class="container_940">
  <img src="<?php bloginfo('template_directory'); ?>/images/banner.jpg" width="940" height="190" /></div>
</div>
    <section id="content" class="clearfix page-widh-sidebar">
    	<div class="content-header-sep"></div>
        <?php if ( have_posts() ) while ( have_posts() ) : the_post(); ?>
            <div class="page">                 	
	            <?php the_content(); ?>
                <form id="medicalnetwork" method="post">
              
             
                <?php
global $wpdb;
$city = $wpdb->get_results("SELECT DISTINCT `city` FROM wp_mednet ;");
$area = $wpdb->get_results("SELECT DISTINCT `area` FROM wp_mednet ;");
$providertype = $wpdb->get_results("SELECT DISTINCT `providertype` FROM wp_mednet ;");
?>
<label> city: </label>
<select name="city" size="1">
<option value="">Select</option>
<?php
foreach($city as $city1){
?>
<option value="<?php echo $city1->city ?>" <?php if($_POST[city] == $city1->city){ ?> selected="selected"<?php } ?> ><?php echo $city1->city ?></option>
<?php
}
?>
</select>

<label>area:</label> 
<select name="area" size="1">
<option value="">Select</option>
<?php
foreach($area as $area1){
?>
<option value="<?php echo $area1->area ?>"<?php if($_POST[area] == $area1->area){ ?> selected="selected"<?php } ?> ><?php echo $area1->area ?></option>
<?php
}
?>
</select>

<label>providertype:</label>
<select name="providertype" size="1">
<option value="">Select</option>
<?php
foreach($providertype as $providertype1){
?>
<option value="<?php echo $providertype1->providertype ?>" <?php if($_POST[providertype] == $providertype1->providertype){ ?> selected="selected"<?php } ?> ><?php echo $providertype1->providertype ?></option>
<?php
}
?>
</select>
<label>order by: </label>
<select name="order">
<option value="city"<?php if($_POST[order] == 'city'){ ?> selected="selected"<?php } ?> >city</option>
<option value="area"<?php if($_POST[order] == 'area'){ ?> selected="selected"<?php } ?> >area</option>
<option value="providertype"><?php if($_POST[order] == 'providertype'){ ?> selected="selected"<?php } ?> provider type</option>
</select>
   <input type="submit" value="Submit" />
                </form>
<?php
if($_SERVER['REQUEST_METHOD'] == 'POST')
{
$providers = $wpdb->get_results("SELECT * FROM wp_mednet where `city` like '".$_POST[city]."' and `area` like '".$_POST[area]."' and `providertype` like '".$_POST[providertype]."' order by '".$_POST[order]."';");
}
else
{
	
//$providers = $wpdb->get_results("SELECT * FROM wp_mednet ;");
}
?>
<?php
if($providers)
{
	foreach($providers as $providers1){
?>
<div class="result clearfix">
<div class="imagethumb">
</div>
<div class="info clearfix">
<h4><?php echo $providers1->providername ?></h4>
<h5 class="providertype"><?php echo $providers1->providertype?></h5>
<h5 class="providerbranch"><?php echo $providers1->mainbranch ?></h5>
</div>
<p class="address"><?php echo $providers1->address1 ?>,<?php echo $providers1->city?>,<?php echo $providers1->country?></p>
<div class="contacts">
<?php if($providers1->telephone1 != 0 || $providers1->telephone2 != 0 || $providers1->telephone3 != 0 || $providers1->telephone4 != 0) {?>
<p>TEL: 

<?php if($providers1->telephone1 != 0) {?>
    <?php echo $providers1->telephone1 ?>
    <?php } ?>  <?php if($providers1->telephone2 != 0) {?>
    ,<?php echo $providers1->telephone2 ?>
    <?php } ?>  <?php if($providers1->telephone3 != 0) {?>
    ,<?php echo $providers1->telephone3 ?>
    <?php } ?>  <?php if($providers1->telephone4 != 0) {?>
    ,<?php echo $providers1->telephone4 ?>
    <?php } ?></p>
    
  <?php } ?>
<p><?php if($providers1->hotline != 0) {?>
    HOTLINE:<?php echo $providers1->hotline ?>
    <?php } ?></p> 
    </div>  
</div>
<?php
	}
}
?>
            <!-- end of page -->
            </div>
        <?php endwhile; ?>
        <?php get_sidebar(); ?>
    <!-- end of content -->
    </section>
<?php get_footer(); ?>


i read your tutorial about pagination but as i told you i am newbie so i couldnt know where exactly to add the code
can you please help me in this issue ?
Thanks
Started: May 15, 2012 Latest Activity: May 15, 2012 wordpress pagination form

CAN U USE THE ARABIC SECTION?
May 15, 2012

1 Answer
what Arabic section ? you mean the arabic section of your site ????

Posted: Rasha.NourELDin
In: May 15, 2012

Your Answer

xDo you want to answer this question? Please login or create an account to post your answer