SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Guru
    Join Date
    Aug 2004
    Location
    Canada
    Posts
    730
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    how to $_GET multiple values

    Is there an easy way to $_GET multiple values from the url:
    Code:
    ?type=forforum&no=0&source0=tr&btitle0=Matthew&no=1&source1=kjv&btitle1=Matthew&checkresult0=1&checkresult1=23195
    The reason I ask is because I want to add more to this later on such as:
    PHP Code:
    ?type=forforum&no=0&source0=tr&btitle0=Matthew&no=1&source1=kjv&btitle1=Matthew&checkresult0=1&checkresult1=23195&no=2&source2=kjv&btitle2=Matthew&checkresult2=23195&no=3...&no=4... 
    This is how it's interpreted so far:
    PHP Code:
    $bk=isset($_GET["book".$no]) ? $_GET["book".$no] : "";
    $ch=isset($_GET["chapter".$no]) ? $_GET["chapter".$no] : "";
    $vs=isset($_GET["verse".$no]) ? $_GET["verse".$no] : "";
    $source=isset($_GET["source".$no]) ? $_GET["source".$no] : "";
    $sourceAbb=Array("kjv""mt""mtnv""tr");
    $SourceName=Array("King James""Masoretic Text""Masoretic No Vowels""Textus Receptus");
    $SourceTable=Array($dbTable3$dbTable7$dbTable9$dbTable8);
    for(
    $i=0$i<count($SourceTable); $i++){
        if(
    $source==$sourceAbb[$i]){
            
    $sql "SELECT * FROM ".$SourceTable[$i]." WHERE book = '".$bk."' AND chapter= '".$ch."'";
            if(
    $vs != 'all'){
                
    $sql .= " AND verse= '".$vs."'";
            }
            
    $sql .= " ORDER BY id ASC";
            
    //echo $sql;
        
    }

    Compare bible texts (and other tools):
    TheWheelofGod

  2. #2
    Keeper of the SFL StarLion's Avatar
    Join Date
    Feb 2006
    Location
    Atlanta, GA, USA
    Posts
    3,748
    Mentioned
    69 Post(s)
    Tagged
    0 Thread(s)
    Simple response: Dont use $_GET so much?

    For example:
    A user comes to your site, and chooses the KJV. Chances are, when they click on the "Next Verse" link, they dont want to change texts at the same time.

    Consider storing this information in $_SESSION, and offer a way to switch your session variables when wanted.


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
  •