SitePoint Sponsor

User Tag List

Results 1 to 15 of 15
  1. #1
    SitePoint Enthusiast JoJoNAloha's Avatar
    Join Date
    Nov 2004
    Location
    Oregon
    Posts
    33
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    the ? marks after .php

    Ok, this may seem dumb...and it probably is...but how do you set the things after the .php like here it says .php?do=newthread&f=34

    is that just a variable, $do, or what?

  2. #2
    SitePoint Evangelist nick0161's Avatar
    Join Date
    Oct 2004
    Location
    australia
    Posts
    424
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    i made the url appear like that using this

    PHP Code:
    echo "<td><a href=bookings.php?eventid=$link_date><font color=\"#666666\"> $day </font></a></td>"
    where $link_date is a variable from php code

    does this help or not really?

  3. #3
    SitePoint Enthusiast JoJoNAloha's Avatar
    Join Date
    Nov 2004
    Location
    Oregon
    Posts
    33
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    in ways, yes...but how about the eventid part?

  4. #4
    SitePoint Evangelist nick0161's Avatar
    Join Date
    Oct 2004
    Location
    australia
    Posts
    424
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    that's just what i used to explain the date, ie url after click on a date link would show

    http://localhost/bookings.php?eventid=2004-11-16

    so would replace eventid to do, in your case for post #1

  5. #5
    SitePoint Enthusiast JoJoNAloha's Avatar
    Join Date
    Nov 2004
    Location
    Oregon
    Posts
    33
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    ok...well maybe some context for what i'm looking for will help

    basically i have a dropdown menu and i wanted to change the default selected item if somebody clicked a link from another page. http://wvbs.t35.com/quote.php is the form

    so i was thinking the links on the other page would be like http://wvbs.t35.com/quote.php?ds1=1
    http://wvbs.t35.com/quote.php?ds2=1
    http://wvbs.t35.com/quote.php?ds3=1
    etc

    and in quote.php for the dropdown i want it to effect would look somethin like this, but so it works

    PHP Code:
    <select name="dslab">
    <option<?php
    switch($ds1)
    {
    case 
    1: echo " selected";
    break;
    default: echo
    "";
    }; 
    ?>>Hardboard Moulded 6-Panel Textured</option>
    <option<?php
    switch($ds2)
    {
    case 
    1: echo " selected";
    break;
    default: echo
    "";
    }; 
    ?>>Thermatru Steel #CS-210 6-Panel</option>
    <option<?php
    switch($ds3)
    {
    case 
    1: echo " selected";
    break;
    default: echo
    "";
    }; 
    ?>>Simpson #3806</option>
    <option<?php
    switch($ds4)
    {
    case 
    1: echo " selected";
    break;
    default: echo
    "";
    }; 
    ?>>Simpson #3816</option>
    </select>
    so basically if they didnt click a link from the other page, it would just have the top selected, if they did click a link, then one of those would return true for 1 and echo the " selected" part and then it would be the default selected item in the menu. but when i type in the address http://wvbs.t35.com/quote.php?ds3=1 it goes to quote.php fine but doesn't change the default selected item to the 3rd option...

    so yeah...if that makes sense...any suggestions?

  6. #6
    SitePoint Evangelist nick0161's Avatar
    Join Date
    Oct 2004
    Location
    australia
    Posts
    424
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    umm i think i might start to understand, two things first
    when you post php code put it in php tage [ p h p ] CODE HERE [ / p h p ]
    without the spaces.
    secondly your website has a big picture covering most of your form.

    now - your code

    i think i understand what you mean, when someone selects something from a drop bar, it will hold that data and load the options for the next drop bar? is this correct?

    EDIT - actually i just looked at your forms and i don't think this is what you meant...

    what's this "other page" you referring to

    so depending on how they get to your page, depends what default items are highlighted in your box?

  7. #7
    SitePoint Enthusiast JoJoNAloha's Avatar
    Join Date
    Nov 2004
    Location
    Oregon
    Posts
    33
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    sorry about that...

    first off...the big picture is a popup ad thing, you should be able to close that...once i get paid for doin this site i will upgrade it so that doesnt show up ever.

    ok, basically i want to have on this other page (which will be (eventually) http://wvbs.t35.com/products-doors.php), pictures of the door slabs that link to the quote.php thing, and depending on which door slab they clicked on, that door slab will be the one selected in that dropdown menu...

  8. #8
    SitePoint Evangelist nick0161's Avatar
    Join Date
    Oct 2004
    Location
    australia
    Posts
    424
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    ah so they chose either double or single in products-doors.php then this will decide which doorslab will be selected in the dropdown menu.

    right?

    ok well my understanding is that in dropdown menu, single door will be index 1 and double index 2. and depending what door that select will mean they have only 2 options for hemlock and primed right?

    so you would say

    from first page - product-doors.php

    pass either 1 or 2 from this page to next page depending what door they chose
    use this number to select the index of the dropmenu
    according to what index was passed will decide what option can be selected

    ie if they select single (1)
    single will be highlighted and then they can only chose 4-9/16 primed or hemlock for that dropdown menu

  9. #9
    SitePoint Enthusiast JoJoNAloha's Avatar
    Join Date
    Nov 2004
    Location
    Oregon
    Posts
    33
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    uhm, ok...no actually, this should be just for one drop downmenu, and i could do similar things later once i know what to do.

    ok, so lets just say i have this link http://wvbs.t35.com/quote.php?ds3=1

    how would i put the ds3 into a switch statement? its not a variable $ds3 because i tried that...

  10. #10
    SitePoint Evangelist nick0161's Avatar
    Join Date
    Oct 2004
    Location
    australia
    Posts
    424
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    don't know about passing ds3 as a variable i think that is the variable name not it's value.

    you know you don't have to you .php?varname=varvalue

    you could just use $_SESSION variables. but if you insist, i don't think you can pass ds3, so swap ds3 with 1 and try something else instead of old ds3 position like

    http://wvbs.t35.com/quote.php?status=ds3

    if you want the 1 add it on after ds3. (not sure how but it wouldn't be hard)

    oops ignore that crap that i wrote

    try
    PHP Code:
    $varname $_POST['ds3']; 

  11. #11
    SitePoint Enthusiast JoJoNAloha's Avatar
    Join Date
    Nov 2004
    Location
    Oregon
    Posts
    33
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    so the thing after the ? is a variable? or not? so i should be able to test what the value of it is... basically if you can tell me in your example .php?status=value (and the value would the thing that changes) how to test what the value of status is...

    thanks for all the help by the way...lol...and sorry i don't get it and i don't explain well

  12. #12
    SitePoint Evangelist nick0161's Avatar
    Join Date
    Oct 2004
    Location
    australia
    Posts
    424
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    ha, that's cool i'm still new to this myself but sitepoint is the place to be for php. hmmm that sounded bad it wasn't meant to rhyme.

    anyway

    so ya stick a value for status ie

    PHP Code:
    $value "smalldoor";
        echo 
    "<a href=quote.php?status=$value> click here </a>"
    next page quote.php

    PHP Code:
    $var $_POST['status'];
    echo 
    $var //to test it. 
    have a crack with that

    ----
    nick
    ---

  13. #13
    SitePoint Enthusiast JoJoNAloha's Avatar
    Join Date
    Nov 2004
    Location
    Oregon
    Posts
    33
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    ok...wow...i tried the $_POST["status"] and it didn't work, so i switched to $_GET["status"] and it WORKED

    THANKS!


    EDIT - O MAN THIS WORKS LIKE A DREAM!

  14. #14
    SitePoint Evangelist nick0161's Avatar
    Join Date
    Oct 2004
    Location
    australia
    Posts
    424
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    ha!.. oops yeh use $_GET
    my bad!

  15. #15
    SitePoint Enthusiast JoJoNAloha's Avatar
    Join Date
    Nov 2004
    Location
    Oregon
    Posts
    33
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    haha...thats cool man, YOU ROCK!


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
  •