url - Php Redirect to a new page from an if statement -


this question has answer here:

please professional programmers in house, wrong code?

i error whenever try run it.

parse error: syntax error, unexpected ';' in c:\xampp\htdocs\a\go.php on line 8

the php code:

<?php  $term=$_post['term']; $level=$_post['level'];  if  (  $term = 'first'; $level='js1';  ) { header("location: result.php"); exit(); }  elseif ( $term = 'first'; $level='js2';  ) { header("location: result2.php"); exit(); }   else { $error = "entry invalid"; }  ?> 

check if condition. if , else if conditions must not contain semicolons. if using 2 comparisons must use && or || in between them. if using = in if , elseif statement return true.

<?php  $term=$_post['term']; $level=$_post['level'];  if  ($term == 'first' && $level=='js1')   {     header("location: result.php");     exit();   }  else if ($term == 'first' && $level='js2')   {     header("location: result2.php");     exit();   }  else {   $error = "entry invalid"; }  ?> 

Comments

Popular posts from this blog

Is there a better way to structure post methods in Class Based Views -

performance - Why is XCHG reg, reg a 3 micro-op instruction on modern Intel architectures? -

jquery - Responsive Navbar with Sub Navbar -