Hey guys!
So I wanted to make some sort of program from my friends bachelorette party to electronically submit rsvps and such, but I only know how to make websites, not how to program, so I’m making a website and burning it to disk.
Anyway, I have “feedback.php” on my server and the form is submitting fine from locally on my machine, but I can’t figure out how to redirect back to the previous page. This is the code I have so far:
<?
session_start();
$_SESSION['ref'] = $_SERVER['SCRIPT_NAME'];
?>
<form action="http://grindesigns.com/feedback.php" id="form1" method="post">
<fieldset>
<label>Your Name:<input name ="name" type="text"></label>
<label>Your E-mail:<input name="email" type="text"></label>
Will you be attending? <input type="radio" name="rsvp" value="yes">Yes<input type="radio" name="rsvp" value="no">No
<div class="btns"><a href="javascript:document.getElementById('form1').reset()" class="more">Clear</a><a href="javascript:document.getElementById('form1').submit()" class="more">Send</a></div>
</fieldset>
</form>
And here is my php file code:
<?php
$name = $_POST['name'];
$email = $_POST['email'];
$rsvp = $_POST['rsvp'];
$msg = "Name: $name\
";
$msg .= "Email: $email\
";
$msg .= "rsvp: $rsvp\
";
$recipient = "user@example.com";
$subject = "RSVP for Lauren!";
$mailheaders = "From:$email\
";
$mailheaders .= "Reply-To:$email";
mail($recipient, $subject, $msg, $mailheaders);
echo "RSVP Received!";
?>
<html>
<head>
<script language="JavaScript">
var time = null
function move() {
window.location = "<?php echo $ref ?>";
}
//-->
</script>
</head>
<body onload="timer=setTimeout('move()',1000)">
<h2>Redirecting back to main</h2>
</body>
</html>
Currently, it just automatically refreshes the php page over and over again.