Sending multiple values from one php page to another?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • dianagaby2002
    New Member
    • Jul 2012
    • 9

    Sending multiple values from one php page to another?

    I have proces.php which will send the values into welcome.php.
    Initially they are
    Code:
    $r1=0; $r2=0; $r3=0;...
    And they increment under a certain condition so some of them will be 0 some 1.

    I cannot retrieve them in welcome.php except the first one.

    proces.php
    ___________

    Code:
    header("Location:welcome.php?scor=$score&fid=$form_id&r1=$r1&r2=$r2&r3=
    	$r3&r4=$r4&r5=$r5&r6=$r6&r7=$r7&r8=$r8&r9=$r9");

    welcome.php
    ____________


    Code:
    <?php
    	$score = $_GET['score'];
    	$form_id = $_GET['fid'];
    	$r1 = $_GET['r1'];
    	$r2 = $_GET['r2'];
    //................................
    ?>

    The error message is:

    Notice: Undefined index: fid in C:\xampp\htdocs \porto\welcome. php on line 6

    Notice: Undefined index: r1 in C:\xampp\htdocs \porto\welcome. php on line 7

    Notice: Undefined index: r2 in C:\xampp\htdocs \porto\welcome. php on line 8

    ............... ............... ..............

    Score is 1; FORM_ID: ;
    r1= ;r2= ;r3= ;r4= ;r5= ;r6= ;r7= ;r8= ;r9= ;


    So only the score is seen(the first argument after the url). The rest are empty.

    I tried with single quotes as seen on another site but didn't worked. I also tried to concatenate the values and the variable names first. I kept finding complicate examples for databases and passing through forms.

    Thank you in advance!
    _______________ _______________ __

    If I send text it goes as so:

    proces.php

    Code:
    $string="some text";	
    header("Location:welcome.php?s=$string");
    welcome.php

    Code:
    $str=$_GET['s'];
    echo $str;
    Some text is now displayed. The URL is:

    Code:
    http://localhost/porto/welcome.php?s=some%20text
    _______________ _______________ _____________

    It works now. I just messed the order or my forms. I have 3 on the same page.
    Last edited by dianagaby2002; Oct 24 '12, 04:41 PM. Reason: Corrected the code
  • Rabbit
    Recognized Expert MVP
    • Jan 2007
    • 12517

    #2
    That should work, what happens when you ouput string that you're passing to header?

    Comment

    Working...