PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
So I am writing a very simple code to validate a certain field on a form and send email if it's good or popup an alert if it's not but I keep getting... Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING in send-mail.php on line 11 ... I have no freaking idea what that means, I have tried checking line 11 but as far as I can tell there is no problem with it. please help, Thank you.
I don't see any reason why you would need to use single quotes here, it appears that the double quotes will work just fine, but doubling them up ('") is likely what's causing the error.
I forgot to put a . after the . $acct " in there. I did what you suggested too and it all works great now. just a side note question sort of thingy, Will that preg_match work right? I want to be able to validate an address. Recently had a bot sending the form 50+ times a day and it doesn't use numbers so I figure if I validate that the first character in teh address field is a number it will stop the bot. does that sound right or am I not thinking correctly?
Thank you for the help.
I'd recommend against validating the e-mail using a rule like that - it's perfectly possible that a real person might prefix their e-mail address with a number as well. There are a lot of solutions such as CAPTCHAs and other form protection methods that would be better suited to the task and wouldn't lock out a real person who is unfortunate enough to have an e-mail that starts with a number.