crumpy1 Posted January 23, 2012 Share Posted January 23, 2012 Hi All, I am trying to create a PHP code that will run a form, however i keep getting the error message Warning: preg_match() [function.preg-match]: No ending delimiter '^' found in D:\xampp\htdocs\HFCC\Scripts\mailprocess.php on line 55 Invalid email address entered. Go Back and try again attached is the complete copy of the code i am using, i have an email text box and label with the id 'email' also my method is POST and my action is Scripts/mailprocess.php. Please let me know if you need any additional details. Any help will be much appreciated. Thanks 17404_.php Quote Link to comment https://forums.phpfreaks.com/topic/255584-warning-preg_match-functionpreg-match-no-ending-delimiter-found-in/ Share on other sites More sharing options...
Adam Posted January 23, 2012 Share Posted January 23, 2012 There was no need to post the entire file, we just needed line 55: if(!preg_match("^[a-z0-9]+([_\\.-][a-z0-9]+)*" ."@"."([a-z0-9]+([\.-][a-z0-9]+)*)+"."\\.[a-z]{2,}"."$",$email)){ The problem is you're not including a delimiter before and after the pattern, therefore PHP is thinking that your delimiter is "^", but of course you're missing the closing delimiter. This is an easy problem to solve, just have a quick read about delimiters in the manual first. Quote Link to comment https://forums.phpfreaks.com/topic/255584-warning-preg_match-functionpreg-match-no-ending-delimiter-found-in/#findComment-1310280 Share on other sites More sharing options...
crumpy1 Posted January 23, 2012 Author Share Posted January 23, 2012 Thank you for the quick response, i have only just started dabbling with PHP so i posted the whole code just in case, i will remember for next time. I have read the link you gave me but i really do not understand it. I do not start studing PHP until May so i am lost with all of it. Can you please tell me how to correct this code as i genuinly have no clue Quote Link to comment https://forums.phpfreaks.com/topic/255584-warning-preg_match-functionpreg-match-no-ending-delimiter-found-in/#findComment-1310286 Share on other sites More sharing options...
Adam Posted January 23, 2012 Share Posted January 23, 2012 Your pattern must be enclosed within delimiters. Replace it with: "/^[a-z0-9]+([_\\.-][a-z0-9]+)*" ."@"."([a-z0-9]+([\.-][a-z0-9]+)*)+"."\\.[a-z]{2,}"."$/" Quote Link to comment https://forums.phpfreaks.com/topic/255584-warning-preg_match-functionpreg-match-no-ending-delimiter-found-in/#findComment-1310288 Share on other sites More sharing options...
crumpy1 Posted January 23, 2012 Author Share Posted January 23, 2012 Thank you for the help, much appreciated. Will change the code tonight and fingers crossed it will work. Thanks Again Quote Link to comment https://forums.phpfreaks.com/topic/255584-warning-preg_match-functionpreg-match-no-ending-delimiter-found-in/#findComment-1310292 Share on other sites More sharing options...
crumpy1 Posted January 23, 2012 Author Share Posted January 23, 2012 Can you please tell me also where or how i can link the thank you message to a webpage instead of just a plain text message. This is the code for the submission is $thanks="<h1> We have received your message.</h1><br /> <p>We will deal with your enquiry as soon as possible</p> <p><ul><li>Go <a href='http://localhost/HFCC/index/'>Back</a> back to the Home Page/li></ul>"; // This is the message given after successfull submission of form. i will create a new page for this but i am unsure on where to put the url (thats if it can be done at all through PHP). Thank you. Quote Link to comment https://forums.phpfreaks.com/topic/255584-warning-preg_match-functionpreg-match-no-ending-delimiter-found-in/#findComment-1310300 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.