Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
My First Script! Contact Form
Old 01-29-2010, 07:45 PM My First Script! Contact Form
Junior Talker

Posts: 4
Name: Elan
Trades: 0
I am trying to add a simple contact form to the front page of my website www.gkicredit.com . The form shows up as I would want (aside from the font being black when I want it to be white!) but when you click submit you get an error " Parse error: syntax error, unexpected $end in /home/bsc/public_html/GKICREDIT.COM/send_contactnew.php on line 31"! I will list my php code for both the form and the send_contact.php file (submit button).

My goal is to make this work any way possible! Thanks in advance!

FORM on Home.php:

PHP Code:
<table width="400" border="0" align="center" cellpadding="3" cellspacing="1">
<
tr>
<
td><strong>Contact Form </strong></td>
</
tr>
</
table>

<
table width="400" border="0" align="center" cellpadding="0" cellspacing="1">
<
tr>
<
td><form method="post" action="send_contactnew.php">
<
table width="100%" border="0" cellspacing="1" cellpadding="3">
<
tr>
<
td width="16%">Full Name</td>
<
td width="2%">:</td>
<
td width="82%"><input name="name" type="text" id="name" size="50"></td>
</
tr>
<
tr>
<
td>CityState</td>
<
td>:</td>
<
td><input name="location" type="text" id="location" size="50"></td>
</
tr>
<
tr>
<
td>Phone Number</td>
<
td>:</td>
<
td><input name="phone" type="text" id="phone" size="50"></td>
</
tr>
<
tr>
<
td>Email</td>
<
td>:</td>
<
td><input name="customer_mail" type="text" id="customer_mail" size="50"></td>
</
tr>
<
tr>
<
td>&nbsp;</td>
<
td>&nbsp;</td>
<
td><input type="submit" name="Submit" value="Submit"> </td>
</
tr>
</
table>
</
form>
</
td>
</
tr>
</
table
send_contactnew.php

PHP Code:
<?php
if($_POST['Submit']) {

//COLLECT DATA
  
$name $_POST['name'];
  
$location $_POST['location'];
  
$phone $_POST['phone'];
  
$customer_mail $_POST['customer_mail'];

//ERROR CHECKING
$error '';

    if (!
$name)
        
$error $error."<b>Full Name</b>";
    if (!
$location)
        
$error $error."<b>City, State</b>";
    if (!
$phone)
        
$error $error."<b>Phone Number</b>";
    if (!
$customer_mail)         
        
$error $error."<b>Email Address</b>";

    if (
$error!="")
        echo 
"<font color='#FF0000'><font size='4'>Please fill out all required fields</font><br />$error</font>";
    else
      {
//SUBMIT & REDIRECT
mail"virtuouse@gmail.com""Contact Form Results"$emailMessage"$name <$email>" );
header"Location: http://gkicredit.com/thankyou.php" );


?>
The goal here is to have all the information placed in the form (Name, city state, phone number, and email) to be sent in an email to virtuouse@gmail.com or whatever I put as the email there. If any other info is needed please feel free to ask! I've been stuck on this for over a week now!

Last edited by eharpaz; 01-29-2010 at 08:26 PM..
eharpaz is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 01-29-2010, 11:06 PM Re: My First Script! Contact Form
Banned

Posts: 119
Trades: 0
Hi in 2nd last line put a concatenation operation between variable $emailMessage & string .Hope it will work .

Happy programming
Fusion BPO is offline
Reply With Quote
View Public Profile Visit Fusion BPO's homepage!
 
Old 01-30-2010, 12:23 AM Re: My First Script! Contact Form
NullPointer's Avatar
Will Code for Food

Posts: 2,815
Name: Matt
Location: Irvine, CA
Trades: 0
It looks like you're missing some closing brackets. One for your else statement toward the end and one for your initial if($_POST['Submit']) statement.
__________________

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
NullPointer is online now
Reply With Quote
View Public Profile Visit NullPointer's homepage!
 
Old 01-30-2010, 01:19 AM Re: My First Script! Contact Form
Junior Talker

Posts: 4
Name: Elan
Trades: 0
I'm not sure what could be wrong? Any suggestions?
eharpaz is offline
Reply With Quote
View Public Profile
 
Old 01-30-2010, 04:20 AM Re: My First Script! Contact Form
lizciz's Avatar
Super Spam Talker

Posts: 807
Name: Mattias Nordahl
Location: Sweden
Trades: 0
As Matt pointed out, add some ending brackets } in appropriate places.
__________________
Your answers will only be as good as your question. Formulate it well and give all the necessary information.
lizciz is offline
Reply With Quote
View Public Profile Visit lizciz's homepage!
 
Old 01-30-2010, 05:44 AM Re: My First Script! Contact Form
Junior Talker

Posts: 4
Name: Elan
Trades: 0
This is my first script, i've been learning on Google. I have no idea where the { } . , ; would go? I'm just asking for a quick look and edit? Thanks
eharpaz is offline
Reply With Quote
View Public Profile
 
Old 01-30-2010, 02:23 PM Re: My First Script! Contact Form
NullPointer's Avatar
Will Code for Food

Posts: 2,815
Name: Matt
Location: Irvine, CA
Trades: 0
Quote:
Originally Posted by eharpaz View Post
I have no idea where the { } . , ; would go?
Brackets { } are used to identify the body of control flow structures (if for foreach while etc.) and classes. If you have an if statement with a body consisting of more than one line you need to use an opening and closing bracket. In your case you've omitted two closing brackets:

PHP Code:
else
      {
//SUBMIT & REDIRECT
mail"virtuouse@gmail.com""Contact Form Results"$emailMessage"$name <$email>" );
header"Location: http://gkicredit.com/thankyou.php" );
     } 
//this bracket corresponds to the else portion of the if statement above
/*this bracket corresponds to if($_POST['Submit']) statement at the beginning of your script */


?> 
__________________

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
NullPointer is online now
Reply With Quote
View Public Profile Visit NullPointer's homepage!
 
Old 01-31-2010, 08:52 AM Re: My First Script! Contact Form
Junior Talker

Posts: 4
Name: Elan
Trades: 0
Thanks guys! I have solved the problem! My script works perfect! I would now just love to change the text color of "Full Name""City, State""Phone Number""Email" which appears on the html side gkicredit.com

This is my code for the Form:

PHP Code:
<table width="400" border="0" align="center" cellpadding="3" cellspacing="1">
<
tr>
<
td><strong>Contact Form </strong></td>
</
tr>
</
table>

<
table width="400" border="0" align="center" cellpadding="0" cellspacing="1">
<
tr>
<
td><form name="form1" method="post" action="send_contactnew.php">
<
table width="100%" border="0" cellspacing="1" cellpadding="3">
<
tr>
<
td width="16%">Full Name</td>
<
td width="2%">:</td>
<
td width="82%"><input name="name" type="text" id="name" size="50"></td>
</
tr>
<
tr>
<
td>CityState</td>
<
td>:</td>
<
td><input name="location" type="text" id="location" size="50"></td>
</
tr>
<
tr>
<
td>Phone Number</td>
<
td>:</td>
<
td><input name="phone" type="text" id="phone" size="50"></td>
</
tr>
<
tr>
<
td>Email</td>
<
td>:</td>
<
td><input name="customer_mail" type="text" id="customer_mail" size="50"></td>
</
tr>
<
tr>
<
td>&nbsp;</td>
<
td>&nbsp;</td>
<
td><input type="submit" name="Submit" value="Submit"> </td>
</
tr>
</
table>
</
form>
</
td>
</
tr>
</
table
eharpaz is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to My First Script! Contact Form
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.36662 seconds with 12 queries