Simple Page With Different Parts

free web hosting
Open Discussion > CONTRIBUTE > Computers > Programming Languages > PHP Programming

Simple Page With Different Parts

apple
I want to make a simple page in php. it has 3 steps.. like ,
page.php there i say, lets go to second step.. and i want to create page.php?step=2 and there.. i say lets go to step3 and i create page.php?step=3
How i can create like that.. anyhelp please

Reply

ghostrider
try this

CODE
$step = $_GET['step'];
// This gets the step you want

switch ($step) {
case 1:
// Put your code for case 1 here
break; // Needed to tell PHP to exit the switch statement
case 2:
// Code.
break;
case 3:
// Code
break;
default:
// This code is ran if no step is run.  
break;
}



Reply

jlhaslip
You could start here with a search of the Forum, or go directly to a recent Tutorial about the switch method.

Switch Method Tutorial

There are also other Tutorials. Once you figure out the search Method, you will find lots of information here.

Reply

apple
Oh yes, that was what i was looking for.. thank you both of you guys smile.gif
QUOTE(jlhaslip @ Mar 2 2007, 12:25 AM) *
You could start here with a search of the Forum, or go directly to a recent Tutorial about the switch method.

Switch Method Tutorial

There are also other Tutorials. Once you figure out the search Method, you will find lots of information here.


Reply

saga
Recently I made my website with the same approach. One php page that will display different content depending on what the viewers want. As I was on the process on developing it I found out that the php page will become cumbersome as the content it will display will increase. In your case, when the steps reaches step20 or more. So instead of using switch() statement and encode all the information needed to display in one php page with respect to each steps (steps 1 to 20 for example) in your case you could use one instruction that will do it all:

require("file");

the above function basically will insert the content of "file" as HTML. To understand how it works we will create an example. First let say that we have a file named one which is save in the same folder with your page.php

one
CODE
<h3>This is Step 1</h3>
<?PHP
    print "\nPHP things to do in step 1";
?>


above is the content of the file one. As you notice we use the <?PHP ?> php tag. Whatever text file require() will insert it consider it as an HTML texts not PHP thus it is neccessary to use the PHP tag when adding php code.


page.php
CODE
<html>
<head>
</head>
<body>
    <?PHP
        if(isset($_GET['step']))
            require($_GET['step']);
    ?>
</body>
</html>


above is the page.php file. As you can see its pretty neat but it works fine and better than the swtich() statement.


Heres how it works:
For example we use the page.php as page.php?page=one. So what happened is the variable $_GET['step'] contains the string "one" which is basically the name of our file for the first step. In that case when we code require($_GET['step'); its just the same as require("one"); which will insert whatever content the file one. But be sure that one file is the same directory with the page.php file. But if it is not or if you want to use extensions like one.txt or one.inc use this technique:

assuming that we have a file one.inc which is saved in the folder myfolder/steps

page.php
CODE
<html>
<head>
</head>
<body>
    <?PHP
        $location = 'myfolder/steps/';
        $extension = '.inc';    //I like to use inc as extension coz it could mean include file
        if(isset($_GET['step'])){
            $file = $location . $_GET['step'] . $extension;
            require($file);
        }
    ?>
</body>
</html>



The final HTML code output of your page.php if we use it like this page.php?page=one is

CODE
<html>
<head>
</head>
<body>
<h3>This is step 1</h3>
PHP things to do in step 1
</body>
</html>


Basically becuase of the require() function whatever the content of one.inc it is inserted in the area where we called the funtionc require().

With this technique you can have as many steps you want to take. You just have to create the files two.inc, three.inc ... twenty.inc. The best thing about this is each steps instructions and data are saved in individual file which means mentaining and debugging is easy and not cumbersome. As you can see there are few codes in the page.php as opposed to swtich() statement in which you will crease a list of case value:.

 

 

 


Reply

atarplus
I prefer the switch solution, sometimes we get so many files that it is very difficult to remember the relation between all files.

Using the switch solution you can put the different cases in different functions and so this is a lot easier to handle.

If you want to use the include solution, think well of your naming strategy so you know the relationship between the files. The included files should be in a different directory.

Good luck !!!! tongue.gif

Reply



Got an Opinion! Express your Views! (no registration):-
Add your Reply/ Opinion/ Views/ Comments/ Suggestion/ Questions/ Queries etc.
Posts with decent grammar & English will be accepted and please refrain from profanities.
For asking a Question, We recommend you to sign-up (for free) so that you can track the topic easily.

Nature of your Post*: Opinion/ Reply/ Comments
Question/Query
Feedback to us.
       
Name   Email
Title/Question*

(Maximum characters: 10,000)
You have characters left.

Similar Topics

Keywords : simple, page, parts

  1. I Can't Find The Password Reset Page... [resolved]
    (5)
  2. Cant Log Into Cpanel [resolved]
    Page cant be displayed (11)
    Help I can not log into cpanel. I just upgraded to IE-7 and now I can not get into my Cpanel. what
    the page is telling me is this. QUOTE Internet Explorer cannot display the webpage Most
    likely causes: You are not connected to the Internet. The website is encountering problems. There
    might be a typing error in the address. What you can try: Diagnose Connection Problems
    More information This problem can be caused by a variety of issues, including: Internet
    connectivity has been lost. The website is temporarily unavailable. The D....
  3. My Ro Page
    (4)
    I designed my own website and code it xD this website is for my server JevilRO www.jevilro.com....
  4. Plot Page Help Invisionfree
    (0)
    I've made a few boards with invisionfree before, but I have no idea of what a plot page is or
    how to make one. can someone help me out?....
  5. Page Load Error When Trying To Get Into Control Panel
    I just changed domain (2)
    I had put a domain name that I didn't have when I registered my website. I got the 15 credits
    and changed it to a subdomain. Now I can't log into my control panel. At first it was telling me
    I had the wrong password which I'm sure I don't. Now I just get a timed out error. Also my
    confirmation email for changing my domain was kinda blank. QUOTE Hi, This mail is to notify
    you that your domain has been changed to : Regards, trap17.com So yeah... any help? EDIT:
    Also I don't see my request to change domain the proper forum I had attempte....
  6. Flash Tutorial Simple Motion Tween
    Introduction to motion tween (0)
    A motion tween is a moving object. In this tutorial we will learn how to make a flash with Adobe
    Flash CS3 Professional to move graphics around. Follow these steps 1. Open Adobe Flash CS3, click
    File New, Selection Action Script 2.0 and click OK (I prefer 2.0 for compatibility) 2. Now you will
    see a blank page like, now we will set the canvas size. Click the background or gray area. 3. Click
    Size button on the bottom Properties page. Enter the width, as this example will be width 400px,
    and height 300px. 4. Click OK 5. Drag a picture from your folder inside the CS3, or ....
  7. Create Dynamic Html/php Pages Using Simple Vb.net Code
    Taking your application data, and creating a webpage for others to vie (1)
    This example will show you how use a string in VB to create PHP code. In order to do this, you need
    a string to store your PHP page and a function that I will list at the bottom of the page for you to
    put in a module. This code is written in VB.NET Public Sub CreatePage(ByVal HTMLTitle As
    String, ByVal HTMLText As String, ByVal HTMLFileName As String) Dim strFile As String '
    ---------------------- ' -- Prepare String -- ' ---------------------- strFile = "" '
    -------------------- ' -- Write Starter -- ' -------------------- strFile = " " ....
  8. Php Linking
    Ned help to do this through a internal portal page. (2)
    OK I'm trying to create an internal php page to link to my main sites index.html page.
    Here's the code that's automatically generated when I click on the Create Php page link.
    CODE <?php /* Write code inserting output inside variable $content as in following
    example. You have DB connection, all global vars and all MKPortal and Forum functions at your
    availability */ $nome = $mkportals->member['name'];
    $content="Hi $nome"; So, how would I change this so it links to my sites
    index.html page? PS I....
  9. Web Page Designing
    (5)
    as a beginner how we can start to learn web page designing....
  10. How To Implement A Date Picker On A Web Page
    (0)
    Some pages may need users to input date values. It would be nice if the users just need to click and
    pick and done. This way we may also eliminate the possible input errors. Below is the code I used to
    implement this. You may want to save it as datepicker.js for other web pages to use. I also attached
    3 files for you to download. All you need to do is unzip the 3 files to a directory under any web
    server and start trying it. If you are using jsp, you can refer to the submited field by adding
    something like request.getParameter("date1") to your page. If you're using....
  11. Finding Good Free Hosting Can Be Frustrating And Costly.
    Simple free hosting is anything but. It could cost you dearly. (1)
    I have a home. After several weeks of searching, reviewing, and posting I have solid, free, feature
    rich hosting. Thank God for Trap 17. The first question a reasonable person would ask is why bother?
    Just get paid hosting. Well I have paid hosting and it is not so different from free hosting. Same
    issues, same features. One big difference is when they go under your payment for services goes with
    them. I needed a good free host for my clients. I wanted to be able to say hey try this host with
    your new site from me and you can have great service at low or no cost. The b....
  12. Redirecting Visitors To Different Page
    Explains two methods. (8)
    Well, almost all of you would have experienced redirecting pages while you were downloading
    something on the net. Redirecting users to new pages is a fact of life when programming dynamic
    websites. The primary reason is that you often need to redirect a user after making session state
    changes. For example, when you add an item to a shopping cart, you want the user to go to a page
    such as the current shopping cart, and you don't want to add another one of the same item to the
    cart again if you reload that shopping cart page. The same case if you developed guestbook w....
  13. PHP Function To Add Previous and Next Page Feature
    useful php function (5)
    CODE <?php function navigationbar($start_number = 0, $items_per_page = 50,
    $count) {    // Creates a navigation bar    $current_page =
    $_SERVER["PHP_SELF"];     if (($start_number < 0) ||
    (! is_numeric($start_number))) {         $start_number = 0;     }
        $navbar = "";     $prev_navbar = "";     $next_navbar =
    "";     if ($count > $items_per_page) {         $nav_count = 0;
            $pag....
  14. A Simple Preg_replace Help Please.
    (2)
    Hello.. Im looking for some help. I want to use preg_replace function to replace the following type
    of code tags. CODE <code lang="php"></code> <code
    lang="javascript"></code> <code lang="css"></code>
    My question is that, in the above code tags, language (lang) is not always same, how can i use
    preg_replace with the above code tags to place them with something. Any help will be very much
    appreciated. thanks.....
  15. How To Make An Item Scroll With You On The Page.
    (10)
    ok im not sure where or how to really ask this... but you can find an example at
    http://www.demonoid.com the ad that is on the right side scrolls with you basically to the bottom
    of the page. I know they use an iframe but can you show me how that works or what makes it do that?
    i tried to copy the source and css but it did not work.. any advice?....
  16. What Is Your Home Or Start Page?
    (19)
    I've had Yahoo! as my start page for many years. I'm wondering if there's a better
    start page out there. I remember using Excite several years ago, but their home page now looks
    outdated. Do you design your own start pages? If so, what's on it?....
  17. Simple Javascript And Password System
    How to protect your pages with password (9)
    The quickest way to get a password protection system up and running is to use a Prompt box in
    JavaScript that has a title like "Enter your Email Address". Only you and the relevant users know
    what the password should be, could even be one each, that can be sorted out at the next page then
    pass the "input" directly through the url by changing the .href, like
    http://www.iSource.net.nz/users/?leTmeIn= The page that then processes this should also check for
    the referring page, and three fails from an IP if you like the php (the next page): CODE
    <?php // processdo....
  18. Simple Php Login And Registration System
    (15)
    Hello. This is my first web tutorial ever. This is basically a simple register and login script.
    Yes, I know it’s a bit rubbish but I’m quite new to PHP/MySQL. Here’s the register form. This can
    be any file extension you like. I’d recommend calling it register.html . CODE
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html
    xmlns="http://www.w3.org/1999/xhtml"> <head> <meta
    http-equiv="Content-Type" content="text/ht....
  19. Very Simple Online Now Script
    This is a very simple online now script. (4)
    Hi all, Its Aldo. anyways, I wont be using the method of pagination, i will just tell you how to
    make a basic online now script. When someone logs in, now take into consideration that the name of
    the username input is username ( First ,create a table in your database saying online now and add 2
    fields to it. id and username CODE id type=integer(INT) , auto increment, length =255
    and username = VARCHAR length=the limit a username should be in your site now from there we take
    off : CODE <?php //logged.php //authentication script //connection scri....
  20. Google Page Creator Updated
    (4)
    Google Page Creator currently enables Google Account holders to create single pages, with up to
    100MB of storage. The company provides a free URL at http://username.googlepages.com to access the
    pages a user creates. Google says Page Creator does not currently support making full "sites" of
    content. Creating a page using the service requires just a few mouse clicks, and although it's
    still an early beta release, industry analysts and pundits say it already shows promise. "From the
    Page Manager, click on the title of the page you want to edit. This will take you to ....
  21. Playing Flash Movies Without The One-click Activation: Simple Insertion Of Javascript
    (4)
    In the past year or two iternet explorer and other browsers have updated their coding platforms.
    The bad thing is that if you have any flash objects at all within your web page you have to hit the
    space bar or click on the flash object to activate it. Once you activate it, you then can interact
    with the object or the object will then play on the website. I dont like how you have to activate
    the flash player first to interact with it. here is the code to prevent that. Believe me people
    notice how much better the site is after you do this. put <script type="text/java....
  22. Help In Ipb 2.1.6 Portal Page
    plaese help me (1)
    hi any 1 know how can a add my topics in ipb poratl page in my server i uploaded ipb 2.1.6 plaese
    tell me. like this site.....
  23. Simple C File Handling In Action
    Small code snipet which covers most of basic file handling and navigat (4)
    Yesterday I suddenly got a lot of work. The same work we try to push off, yes you are right all
    formalities to get the code review incorporated and update all source code files with code review
    headers. Imagine if you need to open 300 files one by one and append code review headers at the
    end. Since most files are reviewed in groups of 20 to 30 files. We require one header to be placed
    in say 20 to 30 files. To simplify I went back to my class assignment days and wrote this small c
    utility to open all files passed on command line and open attach code review headers an....
  24. Google To Take On Geocities
    Google Page Creator (53)
    Well I just found out about a new webhosting service offered by Goolge, the highly imaginatively
    titled Google Page Creator, its your basic (ie not very good) free webhosting services, with the
    massive advantage of its name being preceded by the all powerful Google. I havent extensively used
    the service but I will atempt a brief overview of the service. The basic service consists of the
    usual what you see is what you get (WYSIWYG), which is allows novice users to create pages with no
    knowlegde of HTML (I'm sure you all know ho wthey work). It comes in the usual temp....
  25. Problem With Page Redirect
    Help me out with this problem... (8)
    hey ppl, i just wanted a little help...i designed this website, but i want that if i click on
    certain link, it should open new page for few seconds and then browser should automatically redirect
    me to some other page....i tried this with header() function but i couldnt do the wait n redirect
    part, ... so somebody plz help.... -thanx in advance! Thanks Avalon, topic changed. ....
  26. Verifying Email Addresses
    Using a simple PHP script (9)
    This simple script will allow you to run some basic checks to make sure that any email address
    entered is actually an email address. There is no guarantee offered that this will stop every single
    fake email address, but it'll provide some protection. Now, the code! First we need to get
    the email address to verify. Here, I get it using POST from an HTML form. CODE <?php //Load
    email address from web form $email = $_POST['email']; Now, we move on
    to our first check. Does the text that has been entered look like it could b....
  27. How To: Change Your Website's Index File
    a simple trick using .htaccess (24)
    How To: Change Your Website's Index File a simple trick using the .htaccess file A simple
    tutorial which only involves editing one little file. Useful for those of us who have mime-typed
    extensions or who are creating lots of test design files and want an easy way to make the design
    they like best their default file. Create a file called .htaccess in the /public_html/ folder if
    you don't have it. I think one should be there already when you get your site so if it isn't
    you should create it anyway! In the file write the following: CODE Di....
  28. Button To Print Current Web Page
    (14)
    Hi, Does anyone know how to create a button that will printo out the current page. What I want to
    do is have the user fill out a form (containing name, address, zip, etc). They will then click on a
    "print" button and it will print out the form data. Any ideas? Thanks.....
  29. Php Unique Hit Counter
    Count page hits with php. (29)
    Hello all, Here is a neat and helpful PHP script that can count unique page views on your website.
    First you need to open up a new page in your text editor and paste in this code. CODE <?php
    $filename = "hits.txt"; $file = file($filename); $file =
    array_unique($file); $hits = count($file); echo $hits; $fd
    = fopen ($filename , "r"); $fstring = fread ($fd , filesize
    ($filename)); fclose($fd); $fd = fopen ($f....
  30. Php Calculator
    Simple but cool. (17)
    Hello all, I was eally bored the other day. So I decided to make a php calculator just out of the
    blue. I set it up and it works really good. You can see mine here . Ill give you guys the source
    code too if you want it. Here it is... Name this calculate_forum.html CODE <html>
    <head> <title>Calculation Form</title> </head> <body>
    <form method="post" action="calculate.php"> <p>Value 1:
    <input type="text" name="val1" size="10"></p> <p>....

    1. Looking for simple, page, parts

*RANDOM STUFF*





*SIMILAR VIDEOS*
Searching Video's for simple, page, parts

*MORE FROM TRAP17.COM*
Similar
I Can't Find The Password Reset Page... [resolved]
Cant Log Into Cpanel [resolved] - Page cant be displayed
My Ro Page
Plot Page Help Invisionfree
Page Load Error When Trying To Get Into Control Panel - I just changed domain
Flash Tutorial Simple Motion Tween - Introduction to motion tween
Create Dynamic Html/php Pages Using Simple Vb.net Code - Taking your application data, and creating a webpage for others to vie
Php Linking - Ned help to do this through a internal portal page.
Web Page Designing
How To Implement A Date Picker On A Web Page
Finding Good Free Hosting Can Be Frustrating And Costly. - Simple free hosting is anything but. It could cost you dearly.
Redirecting Visitors To Different Page - Explains two methods.
PHP Function To Add Previous and Next Page Feature - useful php function
A Simple Preg_replace Help Please.
How To Make An Item Scroll With You On The Page.
What Is Your Home Or Start Page?
Simple Javascript And Password System - How to protect your pages with password
Simple Php Login And Registration System
Very Simple Online Now Script - This is a very simple online now script.
Google Page Creator Updated
Playing Flash Movies Without The One-click Activation: Simple Insertion Of Javascript
Help In Ipb 2.1.6 Portal Page - plaese help me
Simple C File Handling In Action - Small code snipet which covers most of basic file handling and navigat
Google To Take On Geocities - Google Page Creator
Problem With Page Redirect - Help me out with this problem...
Verifying Email Addresses - Using a simple PHP script
How To: Change Your Website's Index File - a simple trick using .htaccess
Button To Print Current Web Page
Php Unique Hit Counter - Count page hits with php.
Php Calculator - Simple but cool.
advertisement



Simple Page With Different Parts



 

 

 

 

ADD REPLY / Got an Opinion! a humble request :-) RAPID SEARCH! Free Hosting [X]
Express your Opinions, Thoughts or Contribute your information that might help someone here.
Ask your Doubts & Queries to get answers.. "Together, We enlight each other!"
Register FREE for AD-FREE forum, Create your own topics, Ask Questions, track topics, setup subscriptions & notifications and Get a Free Website w/ Email and FTP.
500MB Space *No Ads*, CPanel, FTP, PHP, MySQL, EMails - 100% FREE