MSUK1 Posted November 4, 2010 Share Posted November 4, 2010 so a user fills out a form, data gets sent to send.php then if successful redirects back to index.php, how on that index.php can i get it to say, sent successfully? Quote Link to comment Share on other sites More sharing options...
waynew Posted November 4, 2010 Share Posted November 4, 2010 After sending, redirect back to index with a GET variable such as header('Location: index.php?sent=Y'); Then on index.php if(isset($_GET['send']) && $_GET['send'] == "Y"){ echo 'Success'; } Quote Link to comment Share on other sites More sharing options...
jcbones Posted November 4, 2010 Share Posted November 4, 2010 send.php //header redirect. header('Location: http://mydomain.com/index.php?sent=1'); index.php $message = NULL; if(isset($_GET['sent'])) { $message = 'Sent Successfully!'; } //decide on your message location, and echo the request. echo $message; *Warning - while you were typing a new reply has been posted. You may wish to review your post. * And it is amazingly similar. Quote Link to comment Share on other sites More sharing options...
MSUK1 Posted November 4, 2010 Author Share Posted November 4, 2010 thankyou very much guys learning more everyday! Quote Link to comment Share on other sites More sharing options...
MSUK1 Posted November 4, 2010 Author Share Posted November 4, 2010 sorry guys, if their was an error, i would return as ?sent=error but (using jcbones method) ?sent=ANYTHING returns the success code how could i add a seperate Quote Link to comment Share on other sites More sharing options...
waynew Posted November 4, 2010 Share Posted November 4, 2010 You could change my code to: header('Location: index.php?sent=N'); if(isset($_GET['send']) && $_GET['send'] == "Y"){ echo 'Success'; } else if(isset($_GET['send']) && $_GET['send'] == "N"){ echo 'Error'; } Quote Link to comment Share on other sites More sharing options...
MSUK1 Posted November 4, 2010 Author Share Posted November 4, 2010 with your method im finding a problem, this happens, http://msukgroup.co/Contact nothing now loads? however if you goto http://www.msukgroup.co/Contact/?send=Y it loads Quote Link to comment Share on other sites More sharing options...
MSUK1 Posted November 4, 2010 Author Share Posted November 4, 2010 <?php $message = NULL; if(isset($_GET['send']) && $_GET['send'] == "Y"){ $message = '- Thankyou, we will reply within 24 Hours'; } else if(sset($_GET['send']) && $_GET['send'] == "N"){ $message = '- Sorry, an error occured please try again'; } ?> and then where i need the message displayed: <fieldset><legend>Online Form <?php echo $message; ?></legend> Quote Link to comment Share on other sites More sharing options...
waynew Posted November 4, 2010 Share Posted November 4, 2010 I misspelled isset on the else if. Retry my code. Quote Link to comment Share on other sites More sharing options...
MSUK1 Posted November 4, 2010 Author Share Posted November 4, 2010 no worries cant beleive i never noticed it, thankyou Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.