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:
    1. <?php
    2. echo '<table>';
    3. echo '</table';
    4. $done = 'Saved';
    5. echo $done;
    6. ?>
    I want that $done String Will Show On Top On Table; Like This,
    PHP:
    1. <?php
    2. echo $done;
    3. echo '<table>';
    4. echo '</table';
    5. $done = 'Saved';
    6. ?>
    Please Help Me
    vOlLvEriNe, Sep 2, 2013 IP
  2. GMF

    GMF Well-Known Member

    Messages:
    856
    Likes Received:
    112
    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 Greenhorn

    Messages:
    54
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    6
    #3
    Its A Code
    PHP:
    1.  
    2. <?php
    3. include ('header.php');
    4. echo '<form>
    5. <input name="GMF" />
    6. <input />
    7. </form>';
    8. if ($_GET['GMF'] == "php")
    9. {
    10. $test = 'Testing';
    11. }
    12.  
    Now I Want tO Show $test Message Above
    Code (Text):
    1. <form>
    2. <input name="GMF" />
    3. <input />
    4. </form>
    Let C,
    PHP:
    1.  
    2. <?php
    3. include ('header.php');
    4. echo $test;
    5. echo '<form>
    6. <input name="GMF" />
    7. <input />
    8. </form>';
    9. if ($_GET['GMF'] == "php")
    10. {
    11. $test = 'Testing';
    12. }
    13.  
    But Nothing Shown :(
    vOlLvEriNe, Sep 3, 2013 IP
  4. sarahk

    sarahk iTamer Staff

    Messages:
    17,423
    Likes Received:
    1,741
    Best Answers:
    37
    Trophy Points:
    510
    #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 Greenhorn

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

    sarahk iTamer Staff

    Messages:
    17,423
    Likes Received:
    1,741
    Best Answers:
    37
    Trophy Points:
    510
    #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
    PHP:
    1. include ('header.php');
    2. if ($_GET['GMF'] == "php")
    3. {
    4. $test = 'Testing';
    5. }
    6. echo $test;
    7. echo '<form>
    8. <input name="GMF" />
    9. <input />
    10. </form>';
    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 Greenhorn

    Messages:
    54
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    6
    #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:
    34
    Likes Received:
    2
    Best Answers:
    2
    Trophy Points:
    38
    #11
    PHP:
    1. include ('header.php');
    2. $GMF = (isset($_GET['GMF']) ? $_GET['GMF'] : "";
    3. if (isset($_GET['GMF']))
    4. {
    5.    if ($_GET['GMF'] == "php") $test = 'Testing';
    6. }
    7. echo $test;
    8. echo '<form>
    9. <input name="GMF" />
    10. <input />
    11. </form>';
    12.  
    or

    PHP:
    1. include ('header.php');
    2.  
    3. if (isset($_GET['GMF'])) if ($_GET['GMF'] == "php") echo 'Testing';
    4.  
    5. echo '<form>
    6. <input name="GMF" />
    7. <input />
    8. </form>';
    9.  
    or

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

    Basti Active Member

    Messages:
    627
    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
    PHP:
    1. include ('header.php');
    2.  
    3. $test = (isset($_GET['GMF']) && $_GET['GMF'] == "php") ? 'testing' : '';
    4. echo $test;
    5.  
    6. echo '<form>
    7.  
    8. <input name="GMF" />
    9.  
    10. <input />
    11.  
    12. </form>';
    Last edited: Sep 11, 2013
    Basti, Sep 11, 2013 IP
  13. xxxize

    xxxize Member

    Messages:
    34
    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:
    627
    Likes Received:
    6
    Best Answers:
    3
    Trophy Points:
    90
    #14
    ha, good spot, your right. Corrected
    Basti, Sep 11, 2013 IP