Results 1 to 8 of 8

Thread: return an array

  1. #1
    bgjyd834 is offline Junior
    Join Date
    Mar 2011
    Posts
    196
    Thanks
    0
    Thanked 1 Time in 1 Post
    Feedback Score
    0

    Default return an array

    I want to be able to enter a number into a textbox on my page, click ok or press enter and then depending on what the number is, open a new page. Basically each number points to a specific page that I assign. How do I do this? Thanks for any help.

  2. #2
    jassmee is offline Sophomore
    Join Date
    Mar 2012
    Posts
    144
    Thanks
    0
    Thanked 1 Time in 1 Post
    Feedback Score
    0

    Default

    yes,you may used the return array in php.. you may get the array valur throught $_post['variable name'];

  3. #3
    susen is offline Freshman
    Join Date
    Apr 2010
    Posts
    40
    Thanks
    0
    Thanked 1 Time in 1 Post
    Feedback Score
    0

    Default

    Use PHP switch statement.
    PHP Code:
    <?php
    //$url is the array holding URLs.
    //$i is the number which determine url.
    switch ($i) {
        case 
    0:
            
    header("Location: $url[0]");
            break;
        case 
    1:
            
    header("Location: $url[1]");
            break;
        case 
    2:
            
    header("Location: $url[2]");
            break;
    }
    ?>

  4. #4
    mobyiapps is offline Freshman
    Join Date
    Dec 2012
    Location
    california,united States
    Posts
    13
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Feedback Score
    0

    Default

    Can you please provide more details on your requirement?
    Hire magento developer at http://www.creativeglance.com

  5. #5
    prince229grips is offline Freshman
    Join Date
    Dec 2012
    Posts
    35
    Thanks
    0
    Thanked 1 Time in 1 Post
    Feedback Score
    0

    Default

    There are some more ways to do the process but for the beginners PHP is the best one. The above code is very convenient.

  6. #6
    Join Date
    Feb 2013
    Posts
    20
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Feedback Score
    0

    Default

    Yes PHP is retrun array . you may used the return array in php page=$_GET['last']

  7. #7
    mpchekuri is offline Freshman
    Join Date
    Mar 2012
    Posts
    13
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Feedback Score
    0

    Default

    You need to create a form with attribute method='post' or 'method=get' and a input field to enter number and then when submited use $_GET or $_POST to retrieve the number entered.

  8. #8
    krusejames1 is offline Freshman
    Join Date
    Mar 2013
    Posts
    10
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Feedback Score
    0

    Default

    The above code is very convenient.

Similar Threads

  1. Return to the top?
    By bgjyd834 in forum Search Engine Optimization
    Replies: 0
    Last Post: 09-23-2011, 05:26 AM
  2. .innerHTML does not return TR and TD tags in FF
    By sunshine in forum JavaScript & AJAX
    Replies: 0
    Last Post: 01-04-2010, 11:24 AM
  3. MM's Return Back
    By MoneyMonsta in forum Introductions
    Replies: 10
    Last Post: 12-10-2009, 07:56 PM
  4. Return the length of a string
    By krates98 in forum JavaScript & AJAX
    Replies: 2
    Last Post: 07-15-2009, 05:19 AM
  5. Return visitors
    By Rajshree in forum Search Engine Optimization
    Replies: 24
    Last Post: 11-29-2008, 03:23 AM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Partners: BOSTON WEB DEVELOPER, LLC   |   WEBCOSMO CLASSIFIEDS