Contact form help

Again - Don't get stuck in the past. I used to do this 10-15 years ago on my web sites. For the last 2-3 years I put my email (and phone) in plain text in a "mailto" call on every web page. I've said it before and I'll say again - I run my domained email and phone through Gmail/GV and I get absolutely NO SPAM!

Technically speaking, you are the one stuck in the past =P most websites had a direct email address on their site a long time ago and then contact forms were implemented for better management of ticket systems and spam.

If you don't get a lot of spam and phone calls the most likely reason is that they aren't finding your site as often. I mean obviously gmail spam filtering is amazing but there should be spam in there (edit: there being the spam folder) for the email you posted if they are finding your site.
 
  • Like
Reactions: AML
Technically speaking, you are the one stuck in the past =P most websites had a direct email address on their site a long time ago and then contact forms were implemented for better management of ticket systems and spam.

If you don't get a lot of spam and phone calls the most likely reason is that they aren't finding your site as often. I mean obviously gmail spam filtering is amazing but there should be spam in there (edit: there being the spam folder) for the email you posted if they are finding your site.

OK - It works for you and that is what is important.

Are we talking contact forms or ticket management systems?

If you had been following the forums, if you ask Google for "computer repair" in my area Google says the name of my business and no other. I have no SCO problems and am always at the top of every search for my area so finding my site is not a problem. Thanks for checking though.
 
Are we talking contact forms or ticket management systems?

If you had been following the forums, if you ask Google for "computer repair" in my area Google says the name of my business and no other. I have no SCO problems and am always at the top of every search for my area so finding my site is not a problem. Thanks for checking though.

I meant contact forms offer better direction (department wise) for ticket systems.

I'm not talking about people in your area i'm talking about telemarketers and spammers. Actually come to think of it i'm not sure if telemarketers and spammers are still pulling local results for all the cities as that is harder to do these days. I'm sure other nibblers can comment if they are still getting calls and spam.
 
I have the original files. Can play around with the original.

The other option is learning how to create my own. Long term plan is to get a Wordpress site done once I have money coming in.

After @Tech Savvy's comments I went back and looked and the three items that are being returned are also the three items in the $require = array statement. For grins add the missing fields in and see if they get returned.
 
After @Tech Savvy's comments I went back and looked and the three items that are being returned are also the three items in the $require = array statement. For grins add the missing fields in and see if they get returned.
That would work too, but that would make it so the user has to enter something in for those fields, but from the looks of it he wanted them to be optional.
 
Your problem is you are checking to see if the field is required but if it's not required you aren't adding it. Look here:


You need to change it to something like this:

Code:
$numRequiredSubmitted =0;
foreach($values as $key => $value){
     if(in_array($value,$required) && !empty($_POST[$value])){
           $numRequiredSubmitted+=1;
     }
        $email_content .= $value.': '.$_POST[$value]."\n";
    }

if ($numRequiredSubmitted != count($required)){
      echo 'PLEASE FILL IN REQUIRED FIELDS';
      exit;
}

Sorry if there are any typos. I'm on my cell phone and coding sucks with autocorrect lol

Question, what is this part for: $key =>
 
Question, what is this part for: $key =>

Arrays are broken down into key/value pairs. So if you take:

Code:
$myArray['dog'] = 'cat'

$myArray would be the array variable,
Dog would be the key, and cat would be the value.

Basically that for each statement is saying: iterate through all elements of the $values array, for each element I want the following block of code to run in which I will reference the key of the array as $key and the value as $value.

So it would run the code within the curly brackets for each of these:
$values = array ('name','phone','company','email','message');
Code:
$values[0] = 'name'
$values[1] = 'phone'
$values[2] = 'company'
$values[3] = 'email'
$values[4] = 'message'

Where $key=0 and $value='name' for the first iteration.

$key=1 and $value='phone' for the second iteration.

$key=2 and $value='company' for the third iteration... and so on.
 
Last edited:
Speaking of being stuck in the past, @Paul Rodgers , rather than waste your time creating your own contact form from scratch, why not just use one out of the plethora of free form building tools? If your site is using WordPress you could use something like Gravity Forms, or if you're doing straight HTML without a CMS you can use something like Jotform or Wufoo and just dump an iframe in there. You'll be done with the whole thing in 10 minutes or less and have a better looking more customizable form in the end too. Features like auto email response with a custom message and more are all standard with these.
 
Arrays are broken down into key/value pairs. So if you take:

Code:
$myArray['dog'] = 'cat'

$myArray would be the array variable,
Dog would be the key, and cat would be the value.

Basically that for each statement is saying: iterate through all elements of the $values array, for each element I want the following block of code to run in which I will reference the key of the array as $key and the value as $value.

So it would run the code within the curly brackets for each of these:
$values = array ('name','phone','company','email','message');
Code:
$values[0] = 'name'
$values[1] = 'phone'
$values[2] = 'company'
$values[3] = 'email'
$values[4] = 'message'

Where $key=0 and $value='name' for the first iteration.

$key=1 and $value='phone' for the second iteration.

$key=2 and $value='company' for the third iteration... and so on.

Gotcha but not used in this particular code right?
 
Speaking of being stuck in the past, @Paul Rodgers , rather than waste your time creating your own contact form from scratch, why not just use one out of the plethora of free form building tools? If your site is using WordPress you could use something like Gravity Forms, or if you're doing straight HTML without a CMS you can use something like Jotform or Wufoo and just dump an iframe in there. You'll be done with the whole thing in 10 minutes or less and have a better looking more customizable form in the end too. Features like auto email response with a custom message and more are all standard with these.

I'm still running a html site. Gonna get a new site done with Wordpress when I have the cash. Wordpress is definitely the way to go.
 
I personally stay away from contact pages. For the most part they piss people off. I put my email ( mailto: ) and phone number up on every web page. I ask people to do what is most comfortable for them - call, text, or email me.
Just keep in mind that mailto: requires them to have a working email account setup, and the mailto: accociation being associated to the email client they actually use. Their email client could be the problem and thats why they are calling you too. A form is much safer.
 
Just keep in mind that mailto: requires them to have a working email account setup, and the mailto: accociation being associated to the email client they actually use. Their email client could be the problem and thats why they are calling you too. A form is much safer.

THIS! You're the one stuck in the past if you think everyone has an email client. The vast majority of residential clients use an online service like Gmail. It's only business clients that have email clients, and even they're switching to Google Apps, which means they don't need an email client at all. A form is quick and easy. The only thing we have them fill out is their name (first only), email address, phone number, and message. This ensures that we have their contact info and lets us filter through the BS.
 
THIS! You're the one stuck in the past if you think everyone has an email client. The vast majority of residential clients use an online service like Gmail. It's only business clients that have email clients, and even they're switching to Google Apps, which means they don't need an email client at all. A form is quick and easy. The only thing we have them fill out is their name (first only), email address, phone number, and message. This ensures that we have their contact info and lets us filter through the BS.

Beat me to it. I was about to make the same comment. With the exit of OE and Windows Live, M$ has no built in email client. So almost all residential clients I see are using webmail.
 
  • Like
Reactions: AML
With the exit of OE and Windows Live, M$ has no built in email client.

Well that's not quite true. Windows 10 has a built in Mail "app" that's pretty slick. I personally use it and ditched Outlook. But honestly, no one really uses those "apps" that are built into Windows 10. It's a testament to how HORRIBLE the UI of Windows 10 is if more people use Windows Live Mail (which didn't come with Windows and had to be downloaded separately), than the Mail "app" that's BUILT INTO EVERY Windows machine.
 
Just keep in mind that mailto: requires them to have a working email account setup, and the mailto: accociation being associated to the email client they actually use. Their email client could be the problem and thats why they are calling you too. A form is much safer.

I should have premised my remarks. The other half of my company is my daughter. She is a recent graduate of the University of Wisconsin with a double major in IT and Marketing (magna cum laud). Besides covering SEO, Google Advertising, site layout and page design, etc. they spent considerable time testing with live users dozens of different concepts, ideas, presentations, web sites, etc. Bottom line - People don't like contact pages! They are clunky, impersonal and the bail/leave page rate is close to 30% in their tests.

Like I said, if they work for you, great. But - People don't like them!
 
I'm still running a html site. Gonna get a new site done with Wordpress when I have the cash. Wordpress is definitely the way to go.

You can put an iFrame in straight HTML. So Jotform or Wufoo will still work for you. You just configure your form on their site, then paste the snippet of code in where you want it.
 
Back
Top