Skip to content

Instantly share code, notes, and snippets.

@08shubhamjindal
Created September 11, 2016 20:45
Show Gist options
  • Save 08shubhamjindal/57a3917f825a31c7121a4420dda96a45 to your computer and use it in GitHub Desktop.
Save 08shubhamjindal/57a3917f825a31c7121a4420dda96a45 to your computer and use it in GitHub Desktop.
redirect of one page to another page
<html>
<head>
<title>PHP Form with redirect of one page to another page </title>
</head>
<body>
<?php
$name = $email = $gender = $comment = $website = "";
if ($_SERVER["REQUEST_METHOD"] == "POST") {
$name = ($_POST["name"]);
$email = ($_POST["email"]);
$website =($_POST["website"]);
$comment =($_POST["comment"]);
$gender =($_POST["gender"]);
}
?>
<form method = "post" action = "game.php">
<table>
<tr>
<td>Name:</td>
<td><input type = "text" name = "name"></td>
</tr>
<tr>
<td>E-mail:</td>
<td><input type = "text" name = "email"></td>
</tr>
<tr>
<td>Specific Time:</td>
<td><input type = "text" name = "website"></td>
</tr>
<tr>
<td>Class details:</td>
<td><textarea name = "comment" rows = "5" cols = "40"></textarea></td>
</tr>
<tr>
<td>Gender:</td>
<td>
<input type = "radio" name = "gender" value = "female">Female
<input type = "radio" name = "gender" value = "male">Male
</td>
</tr>
<tr>
<td>
<input type = "submit" name = "submit" value = "Submit">
</td>
</tr>
</table>
</form>
<?php
echo "<h2>Your Given details are as :</h2>";
echo $name;
echo "<br>";
echo $email;
echo "<br>";
echo $website;
echo "<br>";
echo $comment;
echo "<br>";
echo $gender;
?>
<?php if($name=="shubham") : ?>
"<a href="game1.php" target="_blank">play game</a>";
<?php>if($name=="shubham") :?>
<?php
header('Location: http://www.google.com');
?>
<?php endif; ?>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment