Register

If this is your first visit, please click the Sign Up now button to begin the process of creating your account so you can begin posting on our forums! The Sign Up process will only take up about a minute of two of your time.

Results 1 to 8 of 8

Thread: Problems!!!

  1. #1
    Junior Member
    Join Date
    Nov 2005
    Posts
    4
    Member #
    11849
    im new to PHP and would like to create a wepage using PHP i have a version in HTML and would like to create the site in PHP to make the use of the "IFRAME" tag no longer needed.... i would like it so when the URL "index.php" is accessed and then if say the user was to access a button that sends them to the URL "index.php?page2" and it changes the content....

    Thanx to anyone that can help me in anyway

    I have very little understanding of PHP syntax

  2.  

  3. #2
    Senior Member
    Join Date
    May 2003
    Location
    UK
    Posts
    2,354
    Member #
    1326
    You can either manually type the URL into a href using HTML..
    HTML Code:
    <a href="index.php?p=page2" title="Page 2">page 2..</a>
    Or you can use PHP to write the url like so..
    PHP Code:
    <?php echo "<a href=\"index.php?p=page2\" title=\"Page 2\">page 2..</a>
    Then, in index.php possibly where you display your links you would have something like:

    PHP Code:
    if((isset($_GET['p'])) && (!empty($_GET['p']))) {
      
    $page $_GET['p'];
      
    // this is where you would look up an array, or retrieve from database using the value of $page as your identifier, although we could do it manually like..

      
    if($page=="page2") {
        echo 
    "page 2 text goes here..";
      } 
    Heres a complete script..

    PHP Code:
    <html>

    <head>

    <title>PHP Get Example Script</title>

    </head>

    <body>

    <?php

    if((isset($_GET['p'])) && (!empty($_GET['p']))) {
      
    $page $_GET['p'];

    if(
    $page=="page2") {
      echo 
    "page 2 content goes here..";
    // if statemnt

    // outer if statement
    else { // if p is not set, display the link
    echo "<a href=\"index.php?p=page2\" title=\"Page 2\">page 2..</a>";

    ?>

    </body>
    </html>
    Any questions post back.
    Hope this helps

  4. #3
    Junior Member
    Join Date
    Nov 2005
    Posts
    4
    Member #
    11849
    Thanx for ur help this is exactly what i needed

  5. #4
    Senior Member
    Join Date
    May 2003
    Location
    UK
    Posts
    2,354
    Member #
    1326
    Happy to help..

    My method shows the how-to but you should use the value of $page to either act as a key in an associative array, or a database lookup..

    This means the text/content you wish to appear available on other pages too, not just hand coded into that particular page.

  6. #5
    Member
    Join Date
    Jul 2005
    Posts
    39
    Member #
    10659
    Static pages load faster and use less server resources. Though dynamic pages can be easier to maintain.

  7. #6
    Senior Member Fallout's Avatar
    Join Date
    Aug 2003
    Location
    Richmond, Virginia
    Posts
    543
    Member #
    2748
    T1, I don't think something as simple as printing text from an array will make much more of a server load than serving up a static HTML page. Multiple DB queries or something more complex would surely, but not just printing strings.

  8. #7
    Junior Member
    Join Date
    Nov 2005
    Posts
    4
    Member #
    11849
    thanx for all ur help

  9. #8
    Junior Member
    Join Date
    Nov 2005
    Posts
    4
    Member #
    11849
    Added the following valid HTML to the script getting the error

    Parse error: parse error, unexpected T_STRING, expecting ',' or ';' in /home/fhlinux204/c/customcomputerservices.co.uk/user/htdocs/test/index.php on line 19

    Please could you tell me where im goin wrong.

    please could you also tell me where do i put the main pages HTML Code for the main page ypu would visit (whatever.php)

    PHP Code:
    <html> 

    <head> 

    <title>PHP Get Example Script</title> 

    </head> 

    <body> 


    <?php 

    if((isset($_GET['p'])) && (!empty($_GET['p']))) { 
      
    $page $_GET['p']; 

    if(
    $page=="index") { 
      echo 
    "<body bgcolor="#ffffff" onLoad="MM_preloadImages('images/index_3_f2.gif','images/index_3_f4.gif','images/index_3_f3.gif','images/index_4_f2.gif','images/index_4_f4.gif','images/index_4_f3.gif','images/index_5_f2.gif','images/index_5_f4.gif','images/index_5_f3.gif','images/index_6_f2.gif','images/index_6_f4.gif','images/index_6_f3.gif','images/index_7_f2.gif','images/index_7_f4.gif','images/index_7_f3.gif','images/index_8_f2.gif','images/index_8_f4.gif','images/index_8_f3.gif','images/index_9_f2.gif','images/index_9_f4.gif','images/index_9_f3.gif','images/index_12_f2.gif','images/index_12_f4.gif','images/index_12_f3.gif');">
    <table border="0" cellpadding="0" cellspacing="0" width="1024">
    <!-- 
    fwtable fwsrc="CCS Index.png" fwbase="index.gif" fwstyle="Dreamweaver" fwdocid "696063399" fwnested="0" -->
      <
    tr>
       <
    td><img src="images/spacer.gif" width="186" height="1" border="0" alt=""></td>
       <
    td><img src="images/spacer.gif" width="14" height="1" border="0" alt=""></td>
       <
    td><img src="images/spacer.gif" width="26" height="1" border="0" alt=""></td>
       <
    td><img src="images/spacer.gif" width="74" height="1" border="0" alt=""></td>
       <
    td><img src="images/spacer.gif" width="100" height="1" border="0" alt=""></td>
       <
    td><img src="images/spacer.gif" width="100" height="1" border="0" alt=""></td>
       <
    td><img src="images/spacer.gif" width="100" height="1" border="0" alt=""></td>
       <
    td><img src="images/spacer.gif" width="100" height="1" border="0" alt=""></td>
       <
    td><img src="images/spacer.gif" width="100" height="1" border="0" alt=""></td>
       <
    td><img src="images/spacer.gif" width="100" height="1" border="0" alt=""></td>
       <
    td><img src="images/spacer.gif" width="1" height="1" border="0" alt=""></td>
       <
    td><img src="images/spacer.gif" width="84" height="1" border="0" alt=""></td>
       <
    td><img src="images/spacer.gif" width="18" height="1" border="0" alt=""></td>
       <
    td><img src="images/spacer.gif" width="6" height="1" border="0" alt=""></td>
       <
    td><img src="images/spacer.gif" width="15" height="1" border="0" alt=""></td>
       <
    td><img src="images/spacer.gif" width="1" height="1" border="0" alt=""></td>
      </
    tr>

      <
    tr>
       <
    td rowspan="5" colspan="2"><img name="index_1" src="images/index_1.gif" width="200" height="175" border="0" alt=""></td>
       <
    td colspan="13"><img name="index_2" src="images/index_2.gif" width="824" height="2" border="0" alt=""></td>
       <
    td><img src="images/spacer.gif" width="1" height="2" border="0" alt=""></td>
      </
    tr>
      <
    tr>
       <
    td rowspan="2" colspan="2"><a href="main.html" target="main" onMouseOut="MM_nbGroup('out');" onMouseOver="MM_nbGroup('over','index_3','images/index_3_f2.gif','images/index_3_f4.gif',1);" onClick="MM_nbGroup('down','navbar1','index_3','images/index_3_f3.gif',1);"><img name="index_3" src="images/index_3.gif" width="100" height="39" border="0" alt=""></a></td>
       <
    td rowspan="2"><a href="casespt1.html" target="main" onMouseOut="MM_nbGroup('out');" onMouseOver="MM_nbGroup('over','index_4','images/index_4_f2.gif','images/index_4_f4.gif',1);" onClick="MM_nbGroup('down','navbar1','index_4','images/index_4_f3.gif',1);"><img name="index_4" src="images/index_4.gif" width="100" height="39" border="0" alt=""></a></td>
       <
    td rowspan="2"><a href="faqs.html" target="main" onMouseOut="MM_nbGroup('out');" onMouseOver="MM_nbGroup('over','index_5','images/index_5_f2.gif','images/index_5_f4.gif',1);" onClick="MM_nbGroup('down','navbar1','index_5','images/index_5_f3.gif',1);"><img name="index_5" src="images/index_5.gif" width="100" height="39" border="0" alt=""></a></td>
       <
    td rowspan="2"><a href="request.html" target="main" onMouseOut="MM_nbGroup('out');" onMouseOver="MM_nbGroup('over','index_6','images/index_6_f2.gif','images/index_6_f4.gif',1);" onClick="MM_nbGroup('down','navbar1','index_6','images/index_6_f3.gif',1);"><img name="index_6" src="images/index_6.gif" width="100" height="39" border="0" alt=""></a></td>
       <
    td rowspan="2"><a href="home.html" target="main" onMouseOut="MM_nbGroup('out');" onMouseOver="MM_nbGroup('over','index_7','images/index_7_f2.gif','images/index_7_f4.gif',1);" onClick="MM_nbGroup('down','navbar1','index_7','images/index_7_f3.gif',1);"><img name="index_7" src="images/index_7.gif" width="100" height="39" border="0" alt=""></a></td>
       <
    td rowspan="2"><a href="links.html" target="main" onMouseOut="MM_nbGroup('out');" onMouseOver="MM_nbGroup('over','index_8','images/index_8_f2.gif','images/index_8_f4.gif',1);" onClick="MM_nbGroup('down','navbar1','index_8','images/index_8_f3.gif',1);"><img name="index_8" src="images/index_8.gif" width="100" height="39" border="0" alt=""></a></td>
       <
    td rowspan="2"><a href="/forums" target="_blank" onMouseOut="MM_nbGroup('out');" onMouseOver="MM_nbGroup('over','index_9','images/index_9_f2.gif','images/index_9_f4.gif',1);" onClick="MM_nbGroup('down','navbar1','index_9','images/index_9_f3.gif',1);"><img name="index_9" src="images/index_9.gif" width="100" height="39" border="0" alt=""></a></td>
       <
    td colspan="5"><img name="index_10" src="images/index_10.gif" width="124" height="1" border="0" alt=""></td>
       <
    td><img src="images/spacer.gif" width="1" height="1" border="0" alt=""></td>
      </
    tr>
      <
    tr>
       <
    td><img name="index_11" src="images/index_11.gif" width="1" height="38" border="0" alt=""></td>
       <
    td colspan="3"><a href="mailto:jay@customcomputerservices.co.uk" target="main" onMouseOut="MM_nbGroup('out');" onMouseOver="MM_nbGroup('over','index_12','images/index_12_f2.gif','images/index_12_f4.gif',1);" onClick="MM_nbGroup('down','navbar1','index_12','images/index_12_f3.gif',1);"><img name="index_12" src="images/index_12.gif" width="108" height="38" border="0" alt=""></a></td>
       <
    td><img name="index_13" src="images/index_13.gif" width="15" height="38" border="0" alt=""></td>
       <
    td><img src="images/spacer.gif" width="1" height="38" border="0" alt=""></td>
      </
    tr>
      <
    tr>
       <
    td rowspan="3" colspan="13"><img name="index_14" src="images/index_14.gif" width="824" height="186" border="0" alt=""></td>
       <
    td><img src="images/spacer.gif" width="1" height="1" border="0" alt=""></td>
      </
    tr>
      <
    tr>
       <
    td><img src="images/spacer.gif" width="1" height="133" border="0" alt=""></td>
      </
    tr>
      <
    tr>
       <
    td colspan="2"><img name="index_15" src="images/index_15.gif" width="200" height="52" border="0" alt=""></td>
       <
    td><img src="images/spacer.gif" width="1" height="52" border="0" alt=""></td>
      </
    tr>
      <
    tr>
       <
    td rowspan="2" bgcolor="#FF9900">&nbsp;</td>
       <
    td colspan="2" bgcolor="#000000">&nbsp;</td>
       <
    td colspan="9">&nbsp;</td>
       <
    td bgcolor="#000000">&nbsp;</td>
       <
    td colspan="2"><img name="index_20" src="images/index_20.gif" width="21" height="500" border="0" alt=""></td>
       <
    td><img src="images/spacer.gif" width="1" height="500" border="0" alt=""></td>
      </
    tr>
      <
    tr>
       <
    td colspan="14"><img name="index_21" src="images/index_21.gif" width="838" height="41" border="0" alt=""></td>
       <
    td><img src="images/spacer.gif" width="1" height="41" border="0" alt=""></td>
      </
    tr>
    </
    table>"; 
    } // if statemnt 
    ?> 

    </body> 
    </html>
    Thanx for your time and your help.


Remove Ads

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
All times are GMT -6. The time now is 10:59 PM.
Powered by vBulletin® Version 4.2.3
Copyright © 2019 vBulletin Solutions, Inc. All rights reserved.
vBulletin Skin By: PurevB.com