HaLo2FrEeEk Posted November 20, 2009 Share Posted November 20, 2009 I'm making a simple mailer program that uses SmtpClient() and I've got my form set up with a to, from, subject, and body field, along with a button to send it. I've set up a few if...then statements at the beginning to catch whether the person has put in information for all the required fields (to and from) and confirms if they want to send the message without a subject or body. Well that works just fine, I get a messagebox if I don't enter one of those values...but the code keeps processing. How can I kill it and return the user back to the form if they don't put anything in the to or from field? Right now a user could enter in a to email, from email, no subject, and a body; the script would prompt if they wanted to send the message without a subject. I could hit no, but it'd still send. How can I make it so that the code stops in it's tracks when all required information isn't put in, or if the user says no when asked if they want to send without a subject or body? Quote Link to comment https://forums.phpfreaks.com/topic/182307-pause-a-method-until-a-condition-is-met/ Share on other sites More sharing options...
YourNameHere Posted December 4, 2009 Share Posted December 4, 2009 Well, we're not sure what language you're wanting to write this in but I will tell you in PHP and you can convert. Assuming you have 3 textboxes and a submit button... if ($submit_btn) { // You would write a bunch if IF conditionals to see if each value has been passed in if ($textbox1) { if ($textbox2) { if ($textbox3) { //Process request here } else { //redirect for try-again } } else { //redirect for try-again } } else { //redirect for try-again } } Quote Link to comment https://forums.phpfreaks.com/topic/182307-pause-a-method-until-a-condition-is-met/#findComment-971070 Share on other sites More sharing options...
HaLo2FrEeEk Posted December 12, 2009 Author Share Posted December 12, 2009 C#, sorry. And I figured it out, sorry again. Quote Link to comment https://forums.phpfreaks.com/topic/182307-pause-a-method-until-a-condition-is-met/#findComment-975835 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.