PHP-Submit a form to different pages according to variable values -


i wondering in php web page, like

<form method = "post" action = ?>    age: <input type = "text" name="age">    submit: <input type="submit"> </form> 

for example, if input age larger 18, go page: a.php; else goto b.php

how can fulfil that, in current page or in next forwarding page?

more specifically,

  1. if want in current page,

what think action="function()", , inside function, judgement go a.php or b.php. correct way write action , function()? , saw using onclick="..." well, difference?

  1. if want in next page,

we can write action="c.php" , judgement in c.php page. if so, how in c.php page?

btw, way common used way?

thanks, eve

best way submit same page.

<form method = "post" action = 'c.php'>    age: <input type = "text" name="age">    submit: <input type="submit"> </form> 

in c.php

$age = $_post['age'];     if ($age > 18)  {    //do } else {     //do else } 

Comments

Popular posts from this blog

plot - Remove Objects from Legend When You Have Also Used Fit, Matlab -

java - Why does my date parsing return a weird date? -

Need help in packaging app using TideSDK on Windows -