SitePoint Sponsor

User Tag List

Results 1 to 4 of 4

Hybrid View

  1. #1
    SitePoint Member
    Join Date
    Nov 2004
    Location
    London
    Posts
    2
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Beginner's problem

    Hi there, I'm a beginner in php.. i started to learn via tutorials the basics, and then got to develop a website.

    However, i get to see on loads of php written websites links such as www.example.com/index.php?textbox1="message"

    and then as we get on the adress we get to see written "message" on the textbox1..

    i tried to do that by typing the url followed by ?nameofthebox="message"
    but it doesn't seem to work, so i guess i must type some code inside the php page to enable that.. Can anyone help on that matter?

    Thanks a lot

  2. #2
    SitePoint Wizard mark_W's Avatar
    Join Date
    Mar 2004
    Location
    West Midlands, United Kingdom
    Posts
    2,631
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hiya

    to get data from the url you can use something like this.

    Say you have a script

    PHP Code:

    $page 
    $_GET['page']; //get the bit after the ? in the url i.e ?page=home

    if($page == 'home') {
        echo 
    'HomePage';
    }
    if(
    $page == 'about') {
        echo 
    'About';

    Say, then you want to link to your homepage you do index.php?page=home
    Does this make sense?

  3. #3
    SitePoint Member
    Join Date
    Nov 2004
    Location
    London
    Posts
    2
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    oh thanx, well, half of it is done.. so now that i include

    $page = $_GET['page'];

    how do i get it to insert automatically the bit after ?page= into a textbox called textbox1?

    for eg: http://www.example.com/index.php?page=message

    and then textbox1 has the word "message" as a value

  4. #4
    SitePoint Wizard mark_W's Avatar
    Join Date
    Mar 2004
    Location
    West Midlands, United Kingdom
    Posts
    2,631
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    well, if you want it in a input box you would do

    PHP Code:

    $page 
    $_GET['page'];
    echo 
    "<input type=\"text\" name=\"textbox1\" value=\"$page\">"


Bookmarks

Posting Permissions

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