how to pass a variable between page?

I am now using php and HTML, i don't know how to simply pass a variable between pages. such as $SeqNo appears in reply.php, how could i pass it to reply_p.php ?
Thank you very much.

Comments

  • [b][red]This message was edited by Firestorm at 2003-6-17 6:45:27[/red][/b][hr]
    : I am now using php and HTML, i don't know how to simply pass a variable between pages. such as $SeqNo appears in reply.php, how could i pass it to reply_p.php ?
    : Thank you very much.
    :
    Basically you pass variables when you use forms, eg.
    [code]




    [/code]
    Now, when you send your form you have to variables
    $var_name="put your text here";
    $var_submit="1"; //not sure about the value, could be also the text but it doesn't matter anyway
    now in reply_p.php you could something like:
    [code]
    if(isset($_POST['var_submit']))
    {
    echo $_POST['var_name'];
    }
    [/code]
    you maybe are wondering why I'm using $_POST['var'] instead of $var. This is only to make sure you use the posted and not "getted" variables. This mostly gets important when there might happen something dangerous if someone calls a file like xyz.php?var1=forbidden-value or saying it the other way xyz.php receives the data with the GET method instead of the expected POST method or the other way round. You can proove by using $_GET['afdg'] if you want to recieve data by GET method.

    hope I helped

    PS: what does your blank answer mean? You shouldn't push threads that aren't even one day old ;-)
    ________________________________
    [red]http://www.againsttcpa.com[/red]
    [blue]Don't give big brother a chance![/blue]


    PS2: you probably get a bigger audience in the main public PHP board here
  • : [b][red]This message was edited by Firestorm at 2003-6-17 6:45:27[/red][/b][hr]
    : : I am now using php and HTML, i don't know how to simply pass a variable between pages. such as $SeqNo appears in reply.php, how could i pass it to reply_p.php ?
    : : Thank you very much.
    : :
    : Basically you pass variables when you use forms, eg.
    : [code]
    :
    :
    :
    :
    : [/code]
    : Now, when you send your form you have to variables
    : $var_name="put your text here";
    : $var_submit="1"; //not sure about the value, could be also the text but it doesn't matter anyway
    : now in reply_p.php you could something like:
    : [code]
    : if(isset($_POST['var_submit']))
    : {
    : echo $_POST['var_name'];
    : }
    : [/code]
    : you maybe are wondering why I'm using $_POST['var'] instead of $var. This is only to make sure you use the posted and not "getted" variables. This mostly gets important when there might happen something dangerous if someone calls a file like xyz.php?var1=forbidden-value or saying it the other way xyz.php receives the data with the GET method instead of the expected POST method or the other way round. You can proove by using $_GET['afdg'] if you want to recieve data by GET method.
    :
    : hope I helped
    :
    : PS: what does your blank answer mean? You shouldn't push threads that aren't even one day old ;-)
    : ________________________________
    : [red]http://www.againsttcpa.com[/red]
    : [blue]Don't give big brother a chance![/blue]
    :
    :
    : PS2: you probably get a bigger audience in the main public PHP board here
    :
    Thank you veyr much!!! I got it and find some related materials. Actually, I am the first time to use this message board, it's really good to be helped by others! Yeah!
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories