sachin
sachin

Reputation: 13

Redirect PHP page

I want to redirect my page to save.php when i click save button and redirect my page to next.php when I click next button.

<form name="crtext" method="post" action="o_crt_ext.php" enctype="multipart/form-data">

<input type="submit" name="save" value="save" />
<input type="submit" name="next" value="next" />
</form>

o_crt_ext.php

<?php
if(isset($_POST['save']));
{
header("location:save.php");
}
if(isset($_POST['next']));
{
header("location:next.php");
}
?>

Upvotes: 1

Views: 708

Answers (2)

Johan Eliasson
Johan Eliasson

Reputation: 222

Do you want to send any information if the user click on the Next-button? Of not: here you go.

 <form name="crtext" method="post" action="o_crt_ext.php" enctype="multipart/form-data">

 <input type="submit" name="save" value="save" />
 <input type="button" onclick="window.location.href='next.php'" value="next" />
 </form>

Upvotes: 1

Sufendy
Sufendy

Reputation: 1242

remove the semicolons on the if statements

o_crt_ext.php

<?php
if(isset($_POST['save']))
{
  header("location:save.php");
}
if(isset($_POST['next']))
{
  header("location:next.php");
}
?>

Upvotes: 6

Related Questions