html - PHP passing variable through a form -
hey have been learning php last few days , have decided make test using form , radio buttons. using submit button have managed pass variables process test page, works out calculations , send original page. though have having problems using request receive , display data. apologise ignorance of question.
processtest.php
<?php session_start(); $totalscore = 0; if($_post['q1'] == "a"){$totalscore += 20;} if($_post['q2'] == "c"){$totalscore += 20;} if($_post['q3'] == "b"){$totalscore += 20;} if($_post['q4'] == "a"){$totalscore += 20;} if($_post['q5'] == "c"){$totalscore += 20;} header("location: c1l4.php?totalscore = $totalscore"); exit(); ?> c1l4.php (where test originates)
<? $totalscore=$_get['totalscore']; echo $totalscore; ?> if possible give me brief description have done wrong request , why variable not defined appreciated.
try changing
header("location: c1l4.php?totalscore = $totalscore"); to
header("location: c1l4.php?totalscore=$totalscore");
Comments
Post a Comment