Professional Web Applications Themes

A problem with variables? - PHP Development

Hello! Please help a newbie in PHP... I have a problem with variables. I have a website which has a form. Form asks for an email-address: <form action="conf.php" method="post"> email : <input type"text" name="email"> </form> Variable $email works fine in conf.php but what do I have to do to make the same $email work in other .php -sites? Thanks. Tuuska...

  1. #1

    Default A problem with variables?

    Hello!

    Please help a newbie in PHP... I have a problem with variables.

    I have a website which has a form. Form asks for an email-address:

    <form action="conf.php" method="post">
    email : <input type"text" name="email">
    </form>

    Variable $email works fine in conf.php but what do I have to do to
    make the same $email work in other .php -sites?

    Thanks.

    Tuuska
    Tuuska Guest

  2. #2

    Default Re: A problem with variables?


    "Tuuska" <tuuskatelaketju.net> wrote in message
    news:f7adb5e3.0308051440.2f46c371posting.google.c om...
    > Hello!
    >
    > Please help a newbie in PHP... I have a problem with variables.
    >
    > I have a website which has a form. Form asks for an email-address:
    >
    > <form action="conf.php" method="post">
    > email : <input type"text" name="email">
    > </form>
    >
    > Variable $email works fine in conf.php but what do I have to do to
    > make the same $email work in other .php -sites?
    $email will only be defined in the php page specified in the form action
    property, it will not exist in any other php pages on the site, especially
    if the form is submitted via the POST method.

    If you want to transfer the value of $email from the form action page to
    other php pages, you could use session variables, or a database, or an XML
    file to store the value.

    Also you ought to use $_POST["email"] or $HTTP_POST_VARS["email"] when you
    try to read the form variables.

    (use $_GET["email"] for the 'GET' submission method)

    This is a result of the register_globals property in php.ini being set to
    'off' by default since php version 4.3 was introduced. This measure was
    taken to improve the security of php scripts.
    >
    > Thanks.
    >
    > Tuuska

    Richard Hockey Guest

  3. #3

    Default Re: A problem with variables?

    [email]tuuskatelaketju.net[/email] (Tuuska) wrote in message
    news:<f7adb5e3.0308051440.2f46c371posting.google. com>...
    >
    > I have a website which has a form. Form asks for an email-address:
    >
    > <form action="conf.php" method="post">
    > email : <input type"text" name="email">
    > </form>
    >
    > Variable $email works fine in conf.php but what do I have to do to
    > make the same $email work in other .php -sites?
    Your options are: (1) continue to pass it between pages via GET or
    POST, (2) store it in a session variable, or (3) store it in a cookie.

    Cheers,
    NC
    Nikolai Chuvakhin Guest

  4. #4

    Default Re: A problem with variables?

    by -sites do you mean pages ?

    Put this in your form page, which is php?
    <?PHP
    session_start();
    ?>

    Put this in any other page.
    <?PHP
    session_start();
    ?>
    <?PHP
    $email2 = $_POST['email'];
    //and you can check if you got it ok
    echo $email2;
    ?>
    george Guest

Similar Threads

  1. PROBLEM WITH CLIENT VARIABLES - PLEASE HELP!
    By bdoh in forum Coldfusion - Advanced Techniques
    Replies: 2
    Last Post: July 29th, 12:06 PM
  2. Problem with Session Variables
    By Gomba in forum Macromedia ColdFusion
    Replies: 0
    Last Post: April 1st, 01:16 PM
  3. Global Variables problem
    By Rodrigo Alarcon webforumsuser@macromedia.com in forum Macromedia Director Lingo
    Replies: 3
    Last Post: December 3rd, 11:18 PM
  4. Problem with SESSION variables...
    By ZoombyWoof in forum PHP Development
    Replies: 18
    Last Post: November 4th, 11:08 PM
  5. Problem with global variables
    By Stephane Pointu in forum PHP Development
    Replies: 4
    Last Post: September 20th, 06:10 AM

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
  •  

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