Jump to content

use just 1 page not lots of external?!


jarv

Recommended Posts

hi,

 

I am building a web app and need all my php on one page and links posting to same page etc, at the moment, I am linking to my townpubs.php page see code below:

 

townpubs.php

<!doctype html>
<?php 
include "../config.php";
$loggedIn = (isset($_COOKIE['loggedin']) && $_COOKIE['loggedin'] == 'true')?true:false;

$town = $_REQUEST['RSTOWN'];
$towns = mysql_query("SELECT * FROM pubs WHERE RSTOWN = '".$town."' ORDER BY RSTOWN ASC");
?>
<html>
    <head>
        <meta charset="UTF-8" />
        <title>My Pub Space v1.0 β</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>
 	<!-- TOWNS -->
	<div id="towns" class="current">
            <div class="toolbar">
                <h1>View Pubs</h1>
                <a class="back" href="index.php" rel="external">Home</a>
            </div>
			<h2>Pubs in <?php echo $town ?></h2>
            <ul class="plastic">
               <?php while($row1 = mysql_fetch_array($towns))
				{
				echo '<li class="arrow"><a href="pubinfo.php?PUBID='.$row1['PUBID'].'" rel="external">'.$row1['rsPubName'].'</a></li>'; 
				}
				?>
            </ul>
        </div>
    </body>
</html>

 

I would like to have this on my index.php page:

index.php

<!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);


$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");
if ($loggedin == 'true'){
$locals = mysql_query("SELECT * FROM pubs INNER JOIN favepub_copy ON pubs.PUBID=favepub_copy.PUBID WHERE USERID='".$_SESSION['USERID']."' ORDER BY rsPubName asc");
}
?>
<html>
    <head>
        <meta charset="UTF-8" />
        <title>My Pub Space v1.0 β</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:john.mbiddulph@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">Register an account</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 © 2011 mypubspace.com Created by: jbiddulph.com</p>
         </div>
		<?php } else { ?>
		<div class="toolbar">
			<h1>Hi <?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="#locals">View Locals</a></li>
			<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 © 2011 mypubspace.com Created by: jbiddulph.com</p>
         </div>
		<?php } ?>
	</div>

	<!-- LOCALS -->
	<div id="locals">
            <div class="toolbar">
                <h1>My Locals</h1>
                <a class="back" href="#home">Back</a>
            </div>
            <ul class="plastic">
               <?php while($row1 = mysql_fetch_array($locals))
				{
				echo '<li class="arrow"><a href="pubinfo.php?PUBID='.$row1['PUBID'].'" rel="external">'.$row1['rsPubName'].', '.$row1['rsTown'].'</a></li>'; 
				}
				?>
            </ul>
        </div>

	<!-- TOWNS -->
	<div id="towns">
            <div class="toolbar">
                <h1>View Towns</h1>
                <a class="back" href="#home">Back</a>
            </div>
			<ul class="edgetoedge">
			<?php
			$ltr = '';
			while($row1 = mysql_fetch_array($towns)) {
				 $letter1 = substr($row1['RSTOWN'],0,1);
				 if ($letter1 != $ltr) {
				 print'<li class="sep">'. $letter1 .'</li>';
				 }
				 $ltr = $letter1;
				 echo '<li class="forward"><a href="townpubs.php?RSTOWN='.$row1['RSTOWN'].'" rel="external">'.$row1['RSTOWN'].'<small class="listcounter">'.$row1['PubCount'].'</small></a></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
			$ltr = '';
			while($row1 = mysql_fetch_array($counties)) {
				 $letter1 = substr($row1['RSCOUNTY'],0,1);
				 if ($letter1 != $ltr) {
				 print'<li class="sep">'. $letter1 .'</li>';
				 }
				 $ltr = $letter1;
				 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>
	  
	  
        <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 name="RSUSER" type="text" class="textbox" id="RSUSER" value="" placeholder="Username" /></li>
				 <li><input type="Password" name="RSPASS" value="" placeholder="Password" /></li>
				 <li>Male <input name="RSGENDER" type="radio" value="Male" />  Female <input name="rsGender" type="radio" value="Female" /></li>
				 <li><input name="RSEMAIL" type="text" class="textbox" id="rsEmail" placeholder="Email" /></li>
				 <li><input name="RSMOBILE" type="text" class="textbox" id="rsMobile" placeholder="Mobile No." /></li>
				 <li><input name="RSAGE" type="text" class="textbox" id="datepicker" placeholder="DOB: dd/mm/yyyy" /></li>
            </ul>
            <a style="margin:0 10px;color:rgba(0,0,0,.9)" href="#" class="submit whiteButton">Submit</a>
        </form>
    </body>
</html>

 

I need to set empty variables at the top and link page to itself?!

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.