vendredi 17 juin 2016

Passing a PHP variable via ?page= within a single page web app

I have created a single page Webapp using Bootstrap 3. It looks and feels like the standard IOS contacts app. I am using it for personal data on contacts. The contacts are in a sql table which I am querying. I am trying to pass a the PHP mySql id result to an internal #details id element.

The link is:

<a href="#details?page=<?php echo $duty_row['id'];?>">name</a>

The div is:

<article id="details">
        <div class="container-fluid">
        <?php 
            $therecord = $_GET['page'];
            $result = $Con ->query("SELECT * FROM `myTable` WHERE `id` = '$therecord'");
            $details_row = $result->fetch_array(MYSQLI_BOTH);
        ?>
            <div class="row">
                <a href="#on_duty"><div class="col-xs-1"><span class="glyphicon glyphicon-menu-left floatleft apple_back_chevron appleBlue" aria-hidden="true"></span></div>
                <div class="col-xs-6"><p class="apple_back_text appleBlue">On Duty Coordinators</p></div></a>
                <a href="#edit_coordinators?page=<?php echo $details_row['id'] ;?>"><div class="col-xs-4"><p class="apple_forward_text appleBlue floatright">Edit</p></div>
                <div class="col-xs-1"><p class="glyphicon glyphicon-menu-right floatright apple_forward_chevron appleBlue" aria-hidden="true"></p></div></a>
            </div>
        </div>

        <div class="container-fluid">

            <div class="row">
                <div class="col-xs-3">
                    <img class="img-circle" src="" alt="photo">
                </div>
                <div class="col-xs-9">
                    <h2><?php echo $details_row['name'];?></h2>
                </div>
            </div>          
            <div class="row">
                <div class="apple_list appleGray">
                     <div class="col-xs-8">
                        <p class="appleBlue">station</p>
                        <p class="appleDGray"><?php echo $details_row['station']; ?></p>
                     </div>
                     <div class="col-xs-4">
                     </div>
                </div>
            </div> 
            <div class="row">
              <div class="apple_list appleGray">
                     <div class="col-xs-8">
                        <p class="appleBlue">mobile</p>
                        <p class="appleDGray"><?php echo $details_row['mobile']; ?></p>
                     </div>
                     <div class="col-xs-2"> <a href="sms:<?php echo $details_row['mobile']; ?>"><img class="img-responsive apple_Glyph" src="_images/sms.png"></a></div>
                     <div class="col-xs-2"> <a href="tel:<?php echo $details_row['mobile']; ?>"><img class="img-responsive apple_Glyph" src="_images/phone.png"></a></div>
                </div>
            </div>
        </div> <!-- /container -->
    </article>

How do I pass a PHP "?page=$recordNo" internally? The page id is being passed, but not getting picked up by the next PHP

Aucun commentaire:

Enregistrer un commentaire