Jump to content

Welcome to Geeks to Go - Register now for FREE

Need help with your computer or device? Want to learn new tech skills? You're in the right place!
Geeks to Go is a friendly community of tech experts who can solve any problem you have. Just create a free account and post your question. Our volunteers will reply quickly and guide you through the steps. Don't let tech troubles stop you. Join Geeks to Go now and get the support you need!

How it Works Create Account
Photo

PHP Form


  • Please log in to reply

#1
Epeekid

Epeekid

    New Member

  • Member
  • Pip
  • 8 posts
Hello, I am new to PHP coding and I am also at beginner level of web design. I wanted to create a simple php form to capture information and then have it send that information to an e-mail address. When I received the e-mail it displayed like this:

<br><hr><br>
Resource: <br>
Category: <br>
URL: <br>

I honestly do not know what is wrong with my code. I am using a free web hosting server but, they do claim to support php coding. If anyone can help me out with this problem I would greatly appreciate it. Below is my php Coding. I should also mention that I am using Adobe Dreamweaver CS4 to create my website.

***I changed the name of my e-mail address for privacy purposes***

<?php

/* Subject and Email variables */

$emailSubject = 'Link For GORD!';
$webMaster = '[email protected]';

/* Gathering Data Variables */

$resourceField = $_POST['res'];
$categoryField = $_POST['cat'];
$urlField = $_POST['url'];

$body = <<<EOD
<br><hr><br>
Resource: $res <br>
Category: $cat <br>
URL: $url <br>
EOD;

$headers .= "Content=type: text/html\r\n";
$success = mail ($webMaster, $emailSubject, $body, $headers);

/* Results Rendered as HTML */

$theResults = <<<EOD
<html>
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css">
<!--
body {
background-color: #f1f1f1;
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 12px;
font-style: normal;
line-height: normal;
font-weight: normal;
color: #666666;
text-decoration: none;
}
-->
</style>
</head>

<div>
<div align="left">E-Mail Was Sent!</div>
</div>
</body>
</html>
EOD;
echo "$theResults";

?>
  • 0

Advertisements


#2
modernsavage

modernsavage

    Retired Staff

  • Retired Staff
  • 51 posts
Have you checked configuration of the mail function in the PHP.INI file on the server ?
  • 0

#3
AstraNut

AstraNut

    Member

  • Member
  • PipPipPip
  • 465 posts
Your current hosting package or service MUST allow SMTP ( http://en.wikipedia....ansfer_Protocol ) to work. Otherwise, no email can be sent.

Setting Up the SMTP Service: http://www.code-craf...orial_smtp.html

Use any of the below sites to make the workable form you need:

These are really good online form makers. Just follow the instructions for making it and uploading file(s).

Contact Form Generator: http://www.tele-pro....s/contact_form/
WYSIWYG Form Maker: http://www.jotform.c...CFRQhnAod6laUqA
http://www.thesitewi...dbackform.shtml
http://www.form2email.net/
http://www.phpform.org/

http://www.thepcmanw...form_mail.shtml
http://emailmeform.com/
http://www.freecontactform.com/
http://www.reconn.us...ent/view/12/34/ (Download - Contact Us Script)
http://formsmarts.com/

http://apptools.com/...orms/forms1.php
Form Service: http://www.mycontactform.com/
Online Free Tool, PHP Contact Form Code Generator: http://www.htmlbasix...ntactform.shtml
PHP Mailer Script Step by Step: http://www.htmlgoodi...cle.php/3855686
PHP Sending E-mails: http://www.w3schools...HP/php_mail.asp

How to Make a Slick Ajax Contact Form with jQuery and PHP: http://www.elated.co...orm-jquery-php/
Ajax - Creating an HTML Form: http://www.tizag.com...al/ajaxform.php

Freebie: Good looking Fluid Contact Form: http://www.flashuser...ntact-form.html

Edited by AstraNut, 21 January 2012 - 01:13 AM.

  • 0

#4
Epeekid

Epeekid

    New Member

  • Topic Starter
  • Member
  • Pip
  • 8 posts
Thanks for the Help!
  • 0

#5
Epeekid

Epeekid

    New Member

  • Topic Starter
  • Member
  • Pip
  • 8 posts

Have you checked configuration of the mail function in the PHP.INI file on the server ?


Any Idea how I would do that? I went into the delivery controls and this how it's set-up:

Automatically Detect Configuration (recommended)

- Local Mail Exchanger
If the lowest number mail exchanger points to an IP on this server the server will be configured to accept mail locally and from outside the server.
- Backup Mail Exchanger
If a mail exchanger other than the lowest points to an IP on this server, the server will be configured to act as a backup mail exchanger.
- Remote Mail Exchanger
If there are no mail exchange that point to an IP on this server the server will be configured to not accept mail locally and send mail to the lowest MX record.

Note: Automatic detection of MX configuration is not possible if MX entries do not resolve (ie: you mistype a domain name or enter one that does not exist). If your MX configuration is set to auto and you add or edit an MX record that does not resolve you will see a warning and MX configuration will default back the last known setting.

I didn't see anything for a PHP.INI file.

Edited by Epeekid, 23 January 2012 - 04:00 PM.

  • 0

#6
modernsavage

modernsavage

    Retired Staff

  • Retired Staff
  • 51 posts
If you need to see the PHP configuration of a remote server that you don't have full access to try this.

Create a php file and put the following code in it

<html>
<body>
<?php
phpinfo();

?>
</body>
</html>

Upload the page to your website and then view the page in your browser. It should list the configuration.
  • 0

#7
Epeekid

Epeekid

    New Member

  • Topic Starter
  • Member
  • Pip
  • 8 posts

If you need to see the PHP configuration of a remote server that you don't have full access to try this.

Create a php file and put the following code in it

<html>
<body>
<?php
phpinfo();

?>
</body>
</html>

Upload the page to your website and then view the page in your browser. It should list the configuration.



Ok so i did that and I found this:

Virtual Directory Support disabled
Configuration File (php.ini) Path /usr/local/php53/lib
Loaded Configuration File /usr/local/php53/lib/php.ini
Scan this dir for additional .ini files /usr/local/php53/etc
Additional .ini files parsed /usr/local/php53/etc/extensions.ini

I tried looking up what this means but i didn't have much luck finding information. Does this look right? Sorry, but like i said before my knowledge of PHP is very minimal.
  • 0






Similar Topics

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

As Featured On:

Microsoft Yahoo BBC MSN PC Magazine Washington Post HP