The Web Design Group

... Making the Web accessible to all.

Welcome Guest ( Log In | Register )

 
Reply to this topicStart new topic
> contact form, HELP
stingerlives
post May 20 2018, 10:08 AM
Post #1





Group: Members
Posts: 5
Joined: 20-May 18
Member No.: 26,647



contact form isn't working and for the life of me i can't figure out why. any help is greatly appreciated.

<form action="contact.php">
<div class="form">
<div class="form-text">

<input id="cf_name" type="text" class="textbox" value="Your Name*" onfocus="this.value = '';" onblur="if (this.value == '') {this.value = 'Name';}">
<input id="cf_email" type="text" class="textbox" value="Your E-mail*" onfocus="this.value = '';" onblur="if (this.value == '') {this.value = 'E-mail';}">
<input id="cf_eventinfo" name="Event Info" type="text" class="Subject" value="Event Info" onfocus="this.value = '';" onblur="if (this.value == '') {this.value = 'Event Info';}">
</div>
<textarea id="cf_message" placeholder="Your Message*"></textarea>
<div class="clear"> </div>
<input type="submit" value="SEND MESSAGE">

</div>
</form>

here is my php....

<?php
$field_name = $_POST['cf_name'];
$field_email = $_POST['cf_email'];
$field_eventinfo = $_POST['cf_eventinfo'];
$field_message = $_POST ['cf_message'];

$mail_to = '***@trippswebb.com';
$subject = 'Message from a site visitor '.$field_name;

$body_message = 'From: '.$field_name."\n";
$body_message .= 'E-mail: '.$field_email."\n";
$body_message .= 'Event Info: '.$field_eventinfo."\n";
$body_message .= 'Message: '.$field_message;

$headers = 'From: '.$field_email."\r\n";
$headers .= 'Reply-To: '.$field_email."\r\n";

$mail_status = mail($mail_to, $subject, $body_message, $headers);

if ($mail_status) { ?>
<script language="javascript" type="text/javascript">
alert('Thank you for the message. We will contact you shortly.');
window.location = 'contactlanding.html';
</script>
<?php
}
else { ?>
<script language="javascript" type="text/javascript">
alert('Message failed. Please, send an email to ***@trippswebb.com');
window.location = 'contactlanding.html';
</script>
<?php
}
?>
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
Christian J
post May 20 2018, 11:30 AM
Post #2


.
********

Group: WDG Moderators
Posts: 9,628
Joined: 10-August 06
Member No.: 7



Form fields need NAME attributes (not IDs), whose values correspond with those in the PHP $_POST variables.

BTW I edited the email address in your post, so spambots won't find it.
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
stingerlives
post May 20 2018, 11:43 AM
Post #3





Group: Members
Posts: 5
Joined: 20-May 18
Member No.: 26,647



Thanks for looking out!

didn't fix the problem, its like the action form isn't submitting at all, the button seems to not be registering as it doesn't reload a success or failure page and isn't directing anywhere.

On a separate, but maybe linked, note when I added the php file to my static site in buckets within the google cloud it seemed to throw off my site certificates and deactivated phone and email links. now my a.one tags are just registering under the header <h2> without the link reference

User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
stingerlives
post May 20 2018, 11:48 AM
Post #4





Group: Members
Posts: 5
Joined: 20-May 18
Member No.: 26,647



scratch that if i link directly to https still same issues with certificates.
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
Christian J
post May 20 2018, 02:44 PM
Post #5


.
********

Group: WDG Moderators
Posts: 9,628
Joined: 10-August 06
Member No.: 7



Also, this won't work:

QUOTE
CODE
<form action="contact.php">

You need to use

CODE
<form action="contact.php" method="post">

for the $_POST variables to work.

QUOTE(stingerlives @ May 20 2018, 06:43 PM) *

didn't fix the problem, its like the action form isn't submitting at all

Doesn't the URL change to contact.php (unless the HTML form is also in the contact.php file)?

QUOTE
it doesn't reload a success or failure page and isn't directing anywhere.

Do you get any PHP errors? Does PHP run at all?

QUOTE
On a separate, but maybe linked, note when I added the php file to my static site in buckets within the google cloud it seemed to throw off my site certificates and deactivated phone and email links. now my a.one tags are just registering under the header <h2> without the link reference

Not sure what you meant here, but PHP requires a server with PHP support in order to run.
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
stingerlives
post May 20 2018, 08:17 PM
Post #6





Group: Members
Posts: 5
Joined: 20-May 18
Member No.: 26,647



added method post. still nothing if i run contact form my site from any of my online urls doesn't seem to even point to the php

if from google buckets i launch the index.html "public link" which has an address of:

https://storage.googleapis.com/www.trippsdr...sweb/index.html

then i get this error

This XML file does not appear to have any style information associated with it. The document tree is shown below.
<Error>
<Code>InvalidArgument</Code>
<Message>Invalid argument.</Message>
<Details>
POST object expects Content-Type multipart/form-data
</Details>
</Error>
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
Christian J
post May 21 2018, 05:35 AM
Post #7


.
********

Group: WDG Moderators
Posts: 9,628
Joined: 10-August 06
Member No.: 7



I'm not familiar with Google buckets, but I assume it doesn't support PHP. Nevertheless I tried submitting the form, and it did load https://storage.googleapis.com/www.trippsdr...web/contact.php, so at least the HTML part seems to be working correctly. The error message doesn't look like PHP.

User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
stingerlives
post May 22 2018, 07:14 AM
Post #8





Group: Members
Posts: 5
Joined: 20-May 18
Member No.: 26,647



Thanks for your help, still no answer, i'll post if google sorts through it, if not i'm going back to the trusty linux server this google app engine is a nightmare
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post

Reply to this topicStart new topic
2 User(s) are reading this topic (2 Guests and 0 Anonymous Users)
0 Members:

 



- Lo-Fi Version Time is now: 19th March 2024 - 12:17 AM