Ask a Question related to PHP Development, Design and Development.

  1. #1

    Default Basic PHP question

    Greetings,
    I have a page called test.php. I want to call the same page but pass a
    variable to
    it so that data on the page (retrieved from mysql database ) changes.

    So, can I have inside test.php a call to test.php with a variable ?

    thanks,
    Darryl




    Darryl Guest

  2. Similar Questions and Discussions

    1. Basic FLV question
      Can someone please help me. we wish to stream flv files using Flash Media Server 2. we have installed the program however we are at a loss as to how...
    2. basic 3d question
      Hi, Just a qiuck question....I have created a 3d world and exported it to director. I want to add a basic cube shape I create in 3dstudio max to...
    3. Basic Question
      Hello, I've noticed in some sample code that sometimes people use the @ before a string when concatenating them. Example: string filePath =...
    4. Basic question b/w ASP & ASP .NET
      I would like to know what is the basic difference between ASP and ASP .NET VB AND VB .NET ADO and ADO .NET look forward to your responses
    5. basic css question
      In several of my posts lately, I have made it known that I am nto a huge fan of using newer stuff as opposed to older methods of getting things...
  3. #2

    Default Re: Basic PHP question

    On Tue, 20 Jan 2004 09:34:52 -0600, "Darryl" <darryl@osborne-ind.com>
    wrote:
    >Greetings,
    >I have a page called test.php. I want to call the same page but pass a
    >variable to
    >it so that data on the page (retrieved from mysql database ) changes.
    >
    >So, can I have inside test.php a call to test.php with a variable ?
    Of course! It would go something like this:

    <html>
    <head>title</head>
    <body>
    <?php if ($somevar) {
    # make data call here returning some data
    ?>
    This is page with somevar.
    <?php } else { ?>
    This is without somevar.
    <php } ?>
    </body>
    </head>

    $somevar could be sent by post (form) or get (query string).
    Tyrone Slothrop Guest

  4. #3

    Default Re: Basic PHP question

    Hi Darryl,

    you can call the page directly with variables like:
    test.php?your_var=1&another_one=testing

    or you can eventually use some form:
    echo "<form action=\"test.php?your_var=1\" method=\"post or get\">";

    instead of \"test.php?your_var=1\", you can try also the $_PHPSELF variable
    and use the fields (hidden or normal) from your form..

    Lot of fun..

    Greetz,
    Damir

    "Darryl" <darryl@osborne-ind.com> wrote in message
    news:97ydnQujtdtr1JDd4p2dnA@news.ruraltel.net...
    > Greetings,
    > I have a page called test.php. I want to call the same page but pass a
    > variable to
    > it so that data on the page (retrieved from mysql database ) changes.
    >
    > So, can I have inside test.php a call to test.php with a variable ?
    >
    > thanks,
    > Darryl
    >
    >
    >
    >

    Damir Mehmedovic Guest

  5. #4

    Default Re: Basic PHP question

    Your code is deprecated

    use this one below

    <html>
    <head>title</head>
    <body>
    <?php if ($_REQUEST["somevar"]) {
    # make data call here returning some data
    ?>
    This is page with somevar.
    <?php } else { ?>
    This is without somevar.
    <php } ?>
    </body>
    </head>

    Savut

    "Tyrone Slothrop" <ts@paranoids.com> wrote in message
    news:najq00dtiop6sectf27kthul5oefsv36ep@4ax.com...
    > On Tue, 20 Jan 2004 09:34:52 -0600, "Darryl" <darryl@osborne-ind.com>
    > wrote:
    >
    > >Greetings,
    > >I have a page called test.php. I want to call the same page but pass a
    > >variable to
    > >it so that data on the page (retrieved from mysql database ) changes.
    > >
    > >So, can I have inside test.php a call to test.php with a variable ?
    >
    > Of course! It would go something like this:
    >
    > <html>
    > <head>title</head>
    > <body>
    > <?php if ($somevar) {
    > # make data call here returning some data
    > ?>
    > This is page with somevar.
    > <?php } else { ?>
    > This is without somevar.
    > <php } ?>
    > </body>
    > </head>
    >
    > $somevar could be sent by post (form) or get (query string).

    Savut Guest

  6. #5

    Default Re: Basic PHP question

    > <html>
    > <head>title</head>
    > <body>
    > <?php if ($somevar) {
    > # make data call here returning some data
    > ?>
    > This is page with somevar.
    > <?php } else { ?>
    > This is without somevar.
    > <php } ?>
    > </body>
    > </head>
    >
    > $somevar could be sent by post (form) or get (query string).
    I would recommend that you use the $_POST['somevar'] or respective the
    $_GET['somevar'] vars to read your parameter from the header. Of course,
    Tyrone sample is good and work perfekt, but also if you start php coding,
    learn how to use parmeter in a more secure way.

    You can build a link to parse a varialbe to your page:

    echo '<a href="test.php?var=' . $value . '">sent var</a>';
    if (issset($_GET['var']))
    echo $_GET['var'];

    More detail information [url]www.php.net/manual/en/[/url]

    Michael






    Michael Meckelein Guest

  7. #6

    Default Re: Basic PHP question

    One more question then.
    say I have defined:
    $adj = -60;

    and then in a loop I do:
    $adj = $adj - 30;

    then I want to have something like:
    -30px

    how do I convert to string and concatinate the px on the end?
    I still need $adj to be numeric so I can subtract from it on the next
    loop iteration.

    thanks,
    Darryl


    "Darryl" <darryl@osborne-ind.com> wrote in message
    news:97ydnQujtdtr1JDd4p2dnA@news.ruraltel.net...
    > Greetings,
    > I have a page called test.php. I want to call the same page but pass a
    > variable to
    > it so that data on the page (retrieved from mysql database ) changes.
    >
    > So, can I have inside test.php a call to test.php with a variable ?
    >
    > thanks,
    > Darryl
    >
    >
    >
    >

    Darryl Guest

  8. #7

    Default Re: Basic PHP question

    Nevermind, I figured it out.
    strval() is my friend.


    "Darryl" <darryl@osborne-ind.com> wrote in message
    news:jOCdnc-toMT4P5DdRVn-hw@news.ruraltel.net...
    > One more question then.
    > say I have defined:
    > $adj = -60;
    >
    > and then in a loop I do:
    > $adj = $adj - 30;
    >
    > then I want to have something like:
    > -30px
    >
    > how do I convert to string and concatinate the px on the end?
    > I still need $adj to be numeric so I can subtract from it on the next
    > loop iteration.
    >
    > thanks,
    > Darryl
    >
    >
    > "Darryl" <darryl@osborne-ind.com> wrote in message
    > news:97ydnQujtdtr1JDd4p2dnA@news.ruraltel.net...
    > > Greetings,
    > > I have a page called test.php. I want to call the same page but pass a
    > > variable to
    > > it so that data on the page (retrieved from mysql database ) changes.
    > >
    > > So, can I have inside test.php a call to test.php with a variable ?
    > >
    > > thanks,
    > > Darryl
    > >
    > >
    > >
    > >
    >
    >

    Darryl Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139