Home › Forums › CSS › Trying to make our text fields in contact form REQUIRED! Frustrated!! PLEASE HELP!
- This topic is empty.
December 23, 2012 at 6:18 pm #41561
.December 23, 2012 at 6:20 pm #118785
Here is the HTML:December 23, 2012 at 6:33 pm #118793
@eric, I have the code in place, I’m simply missing something small, I believe. Can you offer a shorter solution than editing all the above code to match mine? Thank you very much sir!December 23, 2012 at 6:41 pm #118795
@eric, or anyone … If I’m using .PHP to submit a contact form, can I also use JS to validate the form?December 23, 2012 at 6:48 pm #118798
I’m in over my head with PHP and JS … I had a friend write this contact submit form code, and am lost!December 23, 2012 at 6:52 pm #118800
Okay, I will try this @eric, thank you. To be clear, will I still be using the PHP to send the form to the email address? This new line of JS will work hand in hand with the PHP, correct? My above PHP code does work, but it just won’t make the fields REQUIRED. Will the above JS make the fields REQUIRED? Thank you sir!December 23, 2012 at 6:59 pm #118802
Okay, so then I’ll please wait if someone else can offer a resolution! Thanks @eric. Anyone if you have way to add just this one tweak, PLEASE HELP!December 24, 2012 at 2:17 am #118818
@hendrix – I don’t see any of your code?
However, I will say this:
Server-side validation is **always necessary**.
> This new line of JS will work hand in hand with the PHP, correct?
**Edit**: I may have misunderstood your question, here. No, they don’t work together (i.e., they don’t *interact*), but you may have been asking if they would *conflict* with each other? If so, that’s unlikely. **/edit**
If you’re still trying to figure this out, please point me to your code, and I’d be happy to help.December 24, 2012 at 11:43 am #118859
@traq, thank you very much for your detailed explanation. Please, remind me the best way to get all the code to you for examination? I believe you suggested GitHub?December 24, 2012 at 12:45 pm #118866
I’ve suggested that before, yes –
(1) copy+paste your code to [gist.github.com](http://gist.github.com)
(2) **** out any sensitive/secure info
(3) click on [Create Public Gist] and share the URL
I was only asking because your initial posts seem to have originally contained code, but do not now. Your original question seems to be missing as well – unless this thread is a continuation of your earlier [CONTACT FORM not working … please help!!](https://css-tricks.com/forums/discussion/comment/86155#Comment_86155) thread? Either way, it would be good if you could explain again where you are with your problem.December 26, 2012 at 9:06 pm #119095
@traq, thank you sir. Here’s the link to the GIST with the PHP and HTML code:
https://gist.github.com/4384872December 27, 2012 at 12:09 am #119099
BTW, your email **is not** “from” the user. It’s “from” your website. Putting the user’s email address here will get your email dropped or flagged as spam by some mail servers or clients.
The `From` email address should always belong to a domain that is allowed to send mail from your mail server (e.g., *your* domain). The easiest solution here is a no-reply address. For example, if my website was `example.com`, I’d use `[email protected]`.
If you want to include the user’s email in the headers, the `Reply-to` field is a good place for it.December 27, 2012 at 4:29 pm #119151
@Eric **do not** use ereg() – it’s deprecated. Use [preg_match()](http://php.net/preg_match) instead.
Why include the spam answer in your email?December 27, 2012 at 4:38 pm #119152
@traq, I’ll check everything once I get home. Thank you very much for taking the time to post sir.December 27, 2012 at 8:55 pm #119162
@traq, I copied and pasted the code, but kept getting errors. I’ll recheck in a bit when I can upload the code. Thank you for your help.
- The forum ‘CSS’ is closed to new topics and replies.