crispweasel Posted September 25, 2008 Share Posted September 25, 2008 i modified eric o'calaghan's sms script to work without teleflip, but can't make it redirect correctly after message is sent this is what i have now // Where are we sending it? $to = "" . $number . $carsuf; //Where is it coming from $header = "From: ". $name . " <" . $email . ">\r\n"; // Add signature to message $messig = "" . $message . $signature; // Send the text message if (@mail($to, $subject, $messig, $header)) { // Give a success notice echo "<center>"; echo "SMS/Text Messenger"; echo "<br>"; echo "Text message sent."; echo "<br>"; echo "Please Use Your Browser's Back Button To Return"; echo "</center>\n"; echo "</body>\n"; echo "</html>\n"; exit; // Give an error that message can't be sent } else { $error = "Sorry, there was an error while trying to send the message - please try again later."; } } } // Show any errors encountered if (isset($error)) { echo "<font color=\"red\"><b>" . $error . "</b></font><br><br>\n"; } ?> what do i need to change to send back to my website and not to a cheesy blank page? Quote Link to comment https://forums.phpfreaks.com/topic/125735-solved-redirect-at-end-of-script/ Share on other sites More sharing options...
Maq Posted September 25, 2008 Share Posted September 25, 2008 header('Location:http://www.php.net'); Or you could use JS if this throws you an error (about headers), but it shouldn't. Quote Link to comment https://forums.phpfreaks.com/topic/125735-solved-redirect-at-end-of-script/#findComment-650159 Share on other sites More sharing options...
xtopolis Posted September 25, 2008 Share Posted September 25, 2008 If you're going to output a success message, you will have to use a <meta http-equiv="refresh" url="3;http://yoururl.com" /> In this manner, you can't force them to redirect. fyi: 3 = time in seconds before redirect occurs @maq You can't use header() if he outputs a success message on that page! Quote Link to comment https://forums.phpfreaks.com/topic/125735-solved-redirect-at-end-of-script/#findComment-650162 Share on other sites More sharing options...
Maq Posted September 25, 2008 Share Posted September 25, 2008 @maq You can't use header() if he outputs a success message on that page! That's what I thought. That's also why I suggest the JS solution instead. Quote Link to comment https://forums.phpfreaks.com/topic/125735-solved-redirect-at-end-of-script/#findComment-650163 Share on other sites More sharing options...
crispweasel Posted September 25, 2008 Author Share Posted September 25, 2008 header('Location:http://www.php.net'); Or you could use JS if this throws you an error (about headers), but it shouldn't. header gives me an error i tried this header("Refresh: 3;url=http://www.textmyex.com"); js? i am fairly new to coding Quote Link to comment https://forums.phpfreaks.com/topic/125735-solved-redirect-at-end-of-script/#findComment-650179 Share on other sites More sharing options...
Maq Posted September 25, 2008 Share Posted September 25, 2008 Sorry, JS is an acronym for Javascript. Try this instead: <br /> <!--<br /> window.location = "http://www.google.com/"<br /> //--><br /> Quote Link to comment https://forums.phpfreaks.com/topic/125735-solved-redirect-at-end-of-script/#findComment-650187 Share on other sites More sharing options...
markjoe Posted September 25, 2008 Share Posted September 25, 2008 Well, i see Maq just posted it but here's mine anyway. How about: <?php if(SUCCESS){ echo "<script type='text/javascript'>window.location.href='gotopage.php'</script>"; } ?> You could even use setTimeout() to add a count down or delay so they have a chance to see the message first. Quote Link to comment https://forums.phpfreaks.com/topic/125735-solved-redirect-at-end-of-script/#findComment-650190 Share on other sites More sharing options...
Maq Posted September 25, 2008 Share Posted September 25, 2008 That's pretty much the same thing I have except you're echoing the JS (javascript) in PHP rather than, in my script, exiting out of php "?>", inserting the JS redirect and going back into PHP "<?php". Quote Link to comment https://forums.phpfreaks.com/topic/125735-solved-redirect-at-end-of-script/#findComment-650192 Share on other sites More sharing options...
crispweasel Posted September 25, 2008 Author Share Posted September 25, 2008 Well, i see Maq just posted it but here's mine anyway. How about: <?php if(SUCCESS){ echo "<script type='text/javascript'>window.location.href='gotopage.php'</script>"; } ?> You could even use setTimeout() to add a count down or delay so they have a chance to see the message first. mark this one solved THANK YOU!!! Quote Link to comment https://forums.phpfreaks.com/topic/125735-solved-redirect-at-end-of-script/#findComment-650204 Share on other sites More sharing options...
Maq Posted September 25, 2008 Share Posted September 25, 2008 mark this one solved That's your responsibility. Look at the lower left (I think) there's a link for "Topic Solved". Quote Link to comment https://forums.phpfreaks.com/topic/125735-solved-redirect-at-end-of-script/#findComment-650206 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.