Jump to content

Someone please help me!


cboscia

Recommended Posts

Hi, I have made my company website in Adobe Muse (please don't throw things at me). It can be found at this link: http://www.inspirecreativeworks.com. I made a form on the Contact page using HTML, and it looks exactly like I needed it to look. I was told in order to make the form send the info to my email address, I had to script some php. If you fill out the form, it gives me this error:

 

Parse error: syntax error, unexpected T_VARIABLE in /home/content/i/n/s/inspire/html/send_form_email.php on line 4

 

I know nothing about php. I have attached two files. One is a simple text file so you can see the html of the actual form. The other is a.php file with my code in it. The idea here is to get the info from the form sent to my email address, AND black spam from getting into my email and such. I was told that code is also in my php doc. 

 

So the question is why isn't this working? Any help from you guys would be greatly appreciated. And if the php is just totally off, can someone supply a link to a php script that WOULD work?

 

Thank you and please, be gentle!  :happy-04:

Chris

html.rtf

send_form_email.php

Link to comment
Share on other sites

You can actually make an HTML form send the data to an email address by setting the action attribute to a mailto link:

<form action="mailto:email@aol.com">

As far as your error. I don't see anything syntactically wrong on line 4. I think the error might actually be from unexpected whitespace characters, possibly from the editor you used.

Link to comment
Share on other sites

You can actually make an HTML form send the data to an email address by setting the action attribute to a mailto link:

<form action="mailto:email@aol.com">

As far as your error. I don't see anything syntactically wrong on line 4. I think the error might actually be from unexpected whitespace characters, possibly from the editor you used.

I have heard that the mailto: action type is not always reliable and the reasoning makes sense to me. I often use computers that don't have a mail client configured.

Link to comment
Share on other sites

Ok, that's like a different language to me. So let's try this... attached is a screen shot of the code, opened in Dreamweaver. Can you tell me what to delete in each line? And keep in mind, I have no idea what UTF-8 or an xA0 non breaking space is.

 

Thanks!

Link to comment
Share on other sites

So does anyone know what code WOULD work for this to be effective? I have heard the mailto command does work, but it is not secure and your email will be overrun by spam, getting hundreds of emails daily.

If your form isn't protected it won't make any difference whether they mail to you directly or through your form.

 

Also I can send your form by simply making requests to:

 

send_form_email.php?email=t@t.t
Put that in a loop and call it say 99999999999999 times? You are gonna have one lovely inbox. Edited by ignace
Link to comment
Share on other sites

The variables like $_REQUEST['email'] correspond directly to the "name" attributes of your input elements on your form. You can get the values of these by using that name in the $_REQUEST variable just like the others:

$message = $_REQUEST['message'] ;
$message .= "\r\nTelephone:" . $_REQUEST['telephone'];
Link to comment
Share on other sites

See if this works for you:

 

 
<?php
session_start();
function spamcheck($field)
  {
  $field=filter_var($field, FILTER_SANITIZE_EMAIL);
 
  if(filter_var($field, FILTER_VALIDATE_EMAIL) && empty($_SESSION['mail_sent']))
    {
$_SESSION['mail_sent'] = 1;
    return TRUE;
    }
  else
    {
    return FALSE;
    }
  }
 
if (isset($_REQUEST['email']))
  {
  $mailcheck = spamcheck($_REQUEST['email']);
  if ($mailcheck==FALSE)
    {
    echo "Invalid input";
    }
  else
    {
    $name = $_REQUEST['name'] ;
    $company_name = $_REQUEST['company name'] ;
    $email = $_REQUEST['email'] ;
    $telephone = $_REQUEST['telephone'] ;
    $message = $_REQUEST['message'] ;
$content = <<<EOF
Name: {$name}
Company: {$company_name}
Email: {$email}
Telephone: {$telephone}
-------------------------------------------------------
{$message}
EOF;
 
mail("cboscia@inspirecreativeworks.com", "I am interested in Inspire Creative Works $subject",
    $content, "From: $email" );
    echo "Thank you for using our mail form";
    }
  }
else
  {
  echo "<form method='post' action='send_form_email.php'>
  Email: <input name='email' type='text'><br>
  Subject: <input name='subject' type='text'><br>
  Message:<br>
  <textarea name='message' rows='15' cols='40'>
  </textarea><br>
  <input type='submit'>
  </form>";
  }
?>
Link to comment
Share on other sites

ignace - I heard the same thing. However, putting the   $field=filter_var($field, FILTER_SANITIZE_EMAIL);

 

 command in there doesn't stop it?

Try it. And no you are only verifying it's e-mail-ish. It does nothing against making sure the script isn't executed repeatedly or sending mass mails.

Link to comment
Share on other sites

If you close and reopen your browser you'll get a new session and it will let you send again.

Which won't help secure your form, a script doesn't have cookies/sessions, so you are only blocking any users that may want to send you a second e-mail. A bot will still simply send out a million mails.

Edited by ignace
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.