PHP header location help?

  • Thread starter Thread starter titchyc
  • Start date Start date
T

titchyc

Guest
I am trying to submit some results to a result.php page but i need to change the location header method so that it submits directly via an action method via a form.

is there a way to do this? the code i have is as follows:

<?php
$totl=question();
$result=0;
$i=0;
$error='';
if(isset($_POST['Submit'])){
while($i < $totl){
$var='question'.$i;
if(isset($_POST[$var]) ){
if($_POST[$var]){
$result+=10;
}
}else{
$error.=' You have forgotten answer to Q. '.($i+1)." <br>";
}
$i++;
}
if(!$error){
Set_Score($user,$result );
header("Location: result.php");
exit();
}
}

$myquestions=get_question();
?>
 
Back
Top