1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

Return Arrey :v

Discussion in 'PHP' started by vOlLvEriNe, Sep 2, 2013.

  1. #1
    Hi All!
    What is return arrey ?
    Am I can this from this function ?

    This is php code
    <?php
    echo '<table>';
    echo '</table';
    $done = 'Saved';
    echo $done;
    ?>
    PHP:
    I want that $done String Will Show On Top On Table; Like This,
    <?php
    echo $done;
    echo '<table>';
    echo '</table';
    $done = 'Saved';
    ?>
    PHP:
    Please Help Me
     
    vOlLvEriNe, Sep 2, 2013 IP
  2. GMF

    GMF Well-Known Member

    Messages:
    855
    Likes Received:
    113
    Best Answers:
    19
    Trophy Points:
    145
    #2
    It is very unclear what you want. Can you rephrase your question please?
     
    GMF, Sep 3, 2013 IP
  3. vOlLvEriNe

    vOlLvEriNe Member

    Messages:
    99
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    41
    #3
    Its A Code
    
    <?php
    include ('header.php');
    echo '<form>
    <input name="GMF" />
    <input />
    </form>';
    if ($_GET['GMF'] == "php")
    {
    $test = 'Testing';
    }
    
    PHP:
    Now I Want tO Show $test Message Above
    <form>
    <input name="GMF" />
    <input />
    </form>
    Code (markup):
    Let C,
    
    <?php
    include ('header.php');
    echo $test;
    echo '<form>
    <input name="GMF" />
    <input />
    </form>';
    if ($_GET['GMF'] == "php")
    {
    $test = 'Testing';
    }
    
    PHP:
    But Nothing Shown :(
     
    vOlLvEriNe, Sep 3, 2013 IP
  4. sarahk

    sarahk iTamer Staff

    Messages:
    28,494
    Likes Received:
    4,457
    Best Answers:
    123
    Trophy Points:
    665
    #4
    You need to echo $test at some point

    I'ts good practice to process your $_GET variables at the beginning of the script and then echo out the variables afterwards.
     
    sarahk, Sep 3, 2013 IP
  5. vOlLvEriNe

    vOlLvEriNe Member

    Messages:
    99
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    41
    #5
    Is There No Any Solution ?
     
    vOlLvEriNe, Sep 3, 2013 IP
  6. sarahk

    sarahk iTamer Staff

    Messages:
    28,494
    Likes Received:
    4,457
    Best Answers:
    123
    Trophy Points:
    665
    #6
    Of course there is, I don't totally understand what you are trying to do but I hope I've pointed you in the right direction.

    It might pay to look up some beginner php tutorials and follow them through just to get some skills before writing your own scripts.
     
    sarahk, Sep 3, 2013 IP
  7. Active Build

    Active Build Peon

    Messages:
    5
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    1
    #7
    include ('header.php');
    if ($_GET['GMF'] == "php")
    {
    $test = 'Testing';
    }
    echo $test;
    echo '<form>
    <input name="GMF" />
    <input />
    </form>';
    PHP:
    Whatever this is, you have misunderstood something.
     
    Active Build, Sep 3, 2013 IP
  8. bartolay13

    bartolay13 Active Member

    Messages:
    735
    Likes Received:
    14
    Best Answers:
    1
    Trophy Points:
    98
    #8
    remember that php code by default is procedural, and is read from left to right top to bottom.
    $test is unset from where you want it
     
    bartolay13, Sep 4, 2013 IP
  9. vOlLvEriNe

    vOlLvEriNe Member

    Messages:
    99
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    41
    #9
    I Have Already Done That, That Confusion Was In My Mind, I Post That Here, As bartolay13 Said, Php Read Top tO Bottom, Now I Understand ..
     
    vOlLvEriNe, Sep 4, 2013 IP
  10. SadClown

    SadClown Member

    Messages:
    8
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    33
    #10
    Yeah everything needs to be in order. You can't echo $test until you set it first. I would echo it inside your if statement though because the variable is not set if $_GET['GMF'] does not equal "php"
     
    SadClown, Sep 10, 2013 IP
  11. xxxize

    xxxize Member

    Messages:
    33
    Likes Received:
    2
    Best Answers:
    2
    Trophy Points:
    38
    #11
    include ('header.php');
    $GMF = (isset($_GET['GMF']) ? $_GET['GMF'] : "";
    if (isset($_GET['GMF']))
    {
       if ($_GET['GMF'] == "php") $test = 'Testing';
    }
    echo $test;
    echo '<form>
    <input name="GMF" />
    <input />
    </form>';
    
    PHP:
    or

    include ('header.php');
    
    if (isset($_GET['GMF'])) if ($_GET['GMF'] == "php") echo 'Testing';
    
    echo '<form>
    <input name="GMF" />
    <input />
    </form>';
    
    PHP:
    or

    include ('header.php');
    
    $GMF = (isset($_GET['GMF']) ? $_GET['GMF'] : "");
    if ($GMF == "php") echo 'Testing';
    
    echo '<form>
    <input name="GMF" />
    <input />
    </form>';
    
    PHP:
     
    xxxize, Sep 10, 2013 IP
  12. Basti

    Basti Active Member

    Messages:
    625
    Likes Received:
    6
    Best Answers:
    3
    Trophy Points:
    90
    #12
    xxxize, no need for the short writing and and then making another if clause. if you use the shorthands, write it all in one
    include ('header.php');
    
    $test = (isset($_GET['GMF']) && $_GET['GMF'] == "php") ? 'testing' : '';
    echo $test;
    
    echo '<form>
    
    <input name="GMF" />
    
    <input />
    
    </form>';
    PHP:
     
    Last edited: Sep 11, 2013
    Basti, Sep 11, 2013 IP
  13. xxxize

    xxxize Member

    Messages:
    33
    Likes Received:
    2
    Best Answers:
    2
    Trophy Points:
    38
    #13
    Yes, you have right.. this was my first view.
    But he check if GMF is "PHP" and printing "testing".. not the same value.
     
    xxxize, Sep 11, 2013 IP
    Basti likes this.
  14. Basti

    Basti Active Member

    Messages:
    625
    Likes Received:
    6
    Best Answers:
    3
    Trophy Points:
    90
    #14
    ha, good spot, your right. Corrected
     
    Basti, Sep 11, 2013 IP