Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    Banned
    Join Date
    Mar 2007
    Posts
    1,523
    Thanks
    116
    Thanked 0 Times in 0 Posts

    Question Passing variables in JQtouch

    hi, I am building a web app, I have a list of towns and a list of counties as you can see here: http://www.mypubspace.com/mobile/#home (best viewed in Safari)

    What I would like to do is to pass through the Town value as a variable and then change my SQL query based on which town is selected

    here is the code
    Code:
    <!doctype html>
    <?php 
     include "../config.php";
    $loggedIn = (isset($_COOKIE['loggedin']) && $_COOKIE['loggedin'] == 'true')?true:false;
    $query1 = "SELECT DISTINCT rsTown FROM pubs ORDER BY rsTown asc";
    $result = mysql_query($query1);
    
    $town = $_REQUEST['RSTOWN'];
    $townpubs = mysql_query("SELECT * FROM pubs WHERE RSTOWN = ".$town." ORDER BY RSTOWN ASC");
    $towns = mysql_query("SELECT DISTINCT RSTOWN, COUNT(PUBID) As PubCount FROM pubs GROUP BY RSTOWN  ORDER BY RSTOWN ASC");
    $counties = mysql_query("SELECT DISTINCT RSCOUNTY, COUNT(PUBID) As PubCount1 FROM pubs GROUP BY RSCOUNTY  ORDER BY RSCOUNTY ASC");
    ?>
    <html>
        <head>
            <meta charset="UTF-8" />
            <title>My Pub Space v1.0 &beta;</title>
            <style type="text/css" media="screen">@import "jqtouch/jqtouch.min.css";</style>
            <style type="text/css" media="screen">@import "themes/jqt/theme.min.css";</style>
            <script src="jqtouch/jquery.1.3.2.min.js" type="text/javascript" charset="utf-8"></script>
            <script src="jqtouch/jqtouch.min.js" type="application/x-javascript" charset="utf-8"></script>
            <script type="text/javascript" charset="utf-8">
                var jQT = new $.jQTouch({
                    icon: 'jqtouch.png',
                    addGlossToIcon: false,
                    startupScreen: 'jqt_startup.png',
                    statusBar: 'black',
                    preloadImages: [
                        'themes/jqt/img/back_button.png',
                        'themes/jqt/img/back_button_clicked.png',
                        'themes/jqt/img/button_clicked.png',
                        'themes/jqt/img/grayButton.png',
                        'themes/jqt/img/whiteButton.png',
                        'themes/jqt/img/loading.gif'
                        ]
                });
            </script>
        </head>
        <body>
        	<div id="about" class="selectable">
    		 <p><img src="jqtouch.png" /></p>
    
    		 <p><strong>My Pub Space</strong><br />Version 1.0 beta<br />
    			  <a href="http://www.jbiddulph.com" target="_blank">By John Biddulph</a></p>
    		 <p><em>Mobile Web Development</em></p>
    		 <p><a href="mailto:xxxxx@gmail.com" target="_blank">E-mail</a></p>
    		 <p><a href="http://twitter.com/#!/jmbiddulph" target="_blank">@jmbiddulph on Twitter</a></p>
    		 <p><br /><br /><a href="#" class="grayButton goback">Close</a></p>
    		</div>
          <div id="home" class="current">
    		  	<?php if (!$loggedIn){ ?>
    			<div class="toolbar">
    				<h1>My Pub Space</h1>
    				<a href="#about" id="infoButton" class="button slideup">About</a>
    			</div>
    			<ul class="rounded">
    				<li class="forward"><a href="#signup">Sign up (FREE!)</a></li>
    				<li class="forward"><a href="#login">Login</a></li>
    				<li class="forward"><a href="#towns">View pubs by town</a></li>
    				<li class="forward"><a href="#counties">View pubs by county</a></li>
    			</ul>
    			<div class="info">
             	<p>All Rights Reserved &copy; 2011 mypubspace.com Created by: jbiddulph.com</p>
             </div>
    			<?php } else { ?>
    			<div class="toolbar">
    				<h1>Welcome <?php echo $_SESSION['s_username'];?></h1>
    				<a href="dologoff.php" rel="external" class="button">Logout</a>
    			</div>
    			<ul class="rounded">
    				<li class="forward"><a href="#towns">View Towns</a></li>
    				<li class="forward"><a href="#counties">View Counties</a></li>
    			</ul>
    			<div class="info">
             	<p>All Rights Reserved &copy; 2011 mypubspace.com Created by: jbiddulph.com</p>
             </div>
    			<?php } ?>
    		</div>
    		
    		
    		<!-- TOWNS -->
    		<div id="towns">
                <div class="toolbar">
                    <h1>View Towns</h1>
                    <a class="back" href="#home">Back</a>
                </div>
                <ul class="edgetoedge">
                   <?php while($row1 = mysql_fetch_array($towns))
    					{
    					echo '<li class="forward"><a href="#townpubs-?RSTOWN='.$row1['RSTOWN'].'" rel="external">'.$row1['RSTOWN'].'<small class="listcounter">'.$row1['PubCount'].'</small></a></li>'; 
    					}
    					?>
                </ul>
            </div>
    		 
    		<div id="townspubs">
                <div class="toolbar">
                    <h1>Pubs in <?php echo $town ?></h1>
                    <a class="back" href="#home">Back</a>
                </div>
                <ul class="edgetoedge">
                   <?php while($row1 = mysql_fetch_array($towns))
    					{
    					echo '<li class="forward">'.$row1['rsPubName'].'</li>'; 
    					}
    					?>
                </ul>
            </div>
    		  
    		  
    		  
    		  <!-- COUNTIES -->
    		  <div id="counties">
                <div class="toolbar">
                    <h1>View Counties</h1>
                    <a class="back" href="#home">Back</a>
                </div>
                <ul class="edgetoedge">
                    <?php while($row1 = mysql_fetch_array($counties))
    					{
    					echo '<li class="forward"><a href="countypubs.php&rsCounty='.$row1['rsCounty'].'" rel="external">'.$row1['RSCOUNTY'].'<small class="listcounter">'.$row1['PubCount1'].'</small></a></li>'; 
    					}
    					?>
                </ul>
            </div>
    		  <div id="countypubs">
                <div class="toolbar">
                    <h1>View Counties</h1>
                    <a class="back" href="#home">Back</a>
                </div>
                <ul class="edgetoedge">
                    <?php while($row3 = mysql_fetch_array($county_pubs))
    					{
    					echo '<li class="forward"><a href="#countypubs&rsCounty='.$row3['rsCounty'].'">'.$row3['RSPUBNAME'].'</a></li>'; 
    					}
    					?>
                </ul>
            </div>
    		  
    		  
            <form id="login" action="dologin.php" method="POST" class="form">
                <div class="toolbar">
                    <h1>Login</h1>
                    <a class="back" href="#">Back</a>
                </div>
                <ul class="rounded">
                    <li><input type="text" name="rsUser" value="" placeholder="Username" /></li>
    					 <li><input type="Password" name="rsPass" value="" placeholder="Password" /></li>
                </ul>
                <a style="margin:0 10px;color:rgba(0,0,0,.9)" href="#" class="submit whiteButton">Submit</a>
            </form>
    		  <form id="signup" action="dosignup.php" method="POST" class="form">
                <div class="toolbar">
                    <h1>Sign up</h1>
                    <a class="back" href="#">Back</a>
                </div>
                <ul class="rounded">
                    <li><select name="rsTown" class="postcodedrop">
    										<option value="">Choose your Town...</option>
    										<?PHP while($row = mysql_fetch_array($result))
    								{
    								
    								echo '<option value="'.$row['rsTown'].'">';
    								echo $row['rsTown'];
    								echo '</option>';
    								}?>
    									</select></li>
    					 <li><input type="Password" name="rsPass" value="" placeholder="Password" /></li>
                </ul>
                <a style="margin:0 10px;color:rgba(0,0,0,.9)" href="#" class="submit whiteButton">Submit</a>
            </form>
        </body>
    </html>

    Please help!
    Last edited by jarv; 02-11-2011 at 01:12 PM.

  • #2
    Banned
    Join Date
    Mar 2007
    Posts
    1,523
    Thanks
    116
    Thanked 0 Times in 0 Posts

    Thumbs up

    please help


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •