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
Sending Forms to Email
Old 09-17-2010, 05:18 PM Sending Forms to Email
Skilled Talker

Posts: 51
Name: Mark Strobel
Trades: 0
I have a website built in PHP and I would like to create my own forms that get sent to my email address. I am very new to PHP and html. I just searched the web on this topic but all the html/php codes/script that I found, didn't work. I would love to create my own forms instead of paying a service to do this for me. Does anyone know which code/script I should use to make this happen? Thanks.
MarkStrobel3367 is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 09-17-2010, 06:25 PM Re: Sending Forms to Email
chrishirst's Avatar
Missing! presumed drunk.

Posts: 42,384
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
HTML for the form and PHP for the data collection and emailing.

http://www.tizag.com/htmlT/forms.php

http://www.tizag.com/phpT/postget.php

http://www.phpeasystep.com/phptu/8.html
__________________
Chris. ->>
Please login or register to view this content. Registration is FREE
<<-

A foolish consistency is the hobgoblin of little minds
Thought for today:- Is SEO the only industry where all the cowboys are Indians?
chrishirst is offline
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 09-18-2010, 01:11 PM Re: Sending Forms to Email
Skilled Talker

Posts: 51
Name: Mark Strobel
Trades: 0
Thank you for your reply. I just tried creating a form using the tutorial of http://www.tizag.com/htmlT/forms.php. However when I click 'submit', the form opens up a blank email form. Per their instructions, I have included the following script to my site:

<form method="post" action="mailto:Mark@StrongFamilies.us">
Name: <input type="text" size="10" maxlength="40" name="name"> <br />
Password: <input type="password" size="10"
maxlength="10" name="password"><br />

<input type="submit" value="Send">
</form>

Do you know what I am doing wrong? I plan to email them regarding this issue as well. Thanks.
MarkStrobel3367 is offline
Reply With Quote
View Public Profile
 
Old 09-18-2010, 01:21 PM Re: Sending Forms to Email
Skilled Talker

Posts: 51
Name: Mark Strobel
Trades: 0
I also just attempted to create a form on my PHP site using the code/script found on http://www.phpeasystep.com/phptu/8.html. However, when publishing that page, I get the following error:

Parse error: syntax error, unexpected '<' in /home/content/s/t/r/strongfamilies/html/onsite-request1.php on line 169

The code that I placed on my site is:
HTML 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_contact.php">
<table width="100%" border="0" cellspacing="1" cellpadding="3">
<tr>
<td width="16%">Subject</td>
<td width="2%">:</td>
<td width="82%"><input name="subject" type="text" id="subject" size="50"></td>
</tr>
<tr>
<td>Detail</td>
<td>:</td>
<td><textarea name="detail" cols="50" rows="4" id="detail"></textarea></td>
</tr>
<tr>
<td>Name</td>
<td>:</td>
<td><input name="name" type="text" id="name" 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"> <input type="reset" name="Submit2" value="Reset"></td>
</tr>
</table>
</form>
</td>
</tr>
</table>

<?php
// Contact subject
$subject ="$subject";
// Details
$message="$detail";

// Mail of sender
$mail_from="$customer_mail";
// From
$header="from: $name <$mail_from>";

// Enter your email address
$to ='Mark@StrongFamilies.us';

$send_contact=mail($to,$subject,$message,$header);

// Check, if message sent to your email
// display message "We've recived your information"
if($send_contact){
echo "We've recived your contact information";
}
else {
echo "ERROR";
}

I just emailed them as well regarding this issue. Do you happen to know what I did wrong? Thanks.

Last edited by chrishirst; 09-18-2010 at 01:23 PM..
MarkStrobel3367 is offline
Reply With Quote
View Public Profile
 
Old 09-18-2010, 01:22 PM Re: Sending Forms to Email
chrishirst's Avatar
Missing! presumed drunk.

Posts: 42,384
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
That's because you need to look at the next two tutorials on how to collect the data and then email it.
__________________
Chris. ->>
Please login or register to view this content. Registration is FREE
<<-

A foolish consistency is the hobgoblin of little minds
Thought for today:- Is SEO the only industry where all the cowboys are Indians?
chrishirst is offline
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 09-18-2010, 01:26 PM Re: Sending Forms to Email
chrishirst's Avatar
Missing! presumed drunk.

Posts: 42,384
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
in the second part of the question you are missing the end delimiter from the PHP code.

And which is line 169?
__________________
Chris. ->>
Please login or register to view this content. Registration is FREE
<<-

A foolish consistency is the hobgoblin of little minds
Thought for today:- Is SEO the only industry where all the cowboys are Indians?
chrishirst is offline
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 09-18-2010, 06:52 PM Re: Sending Forms to Email
Skilled Talker

Posts: 51
Name: Mark Strobel
Trades: 0
Chris, thanks again for your response. I am a novice at web design at best!! I read over http://www.tizag.com/phpT/postget.php around 3 times and I cannot figure out how to integrate it within the original script. Regarding the missing php code on line 169, I don't really know what this means. Can you please break this down for me and what code do I need? Thanks.
MarkStrobel3367 is offline
Reply With Quote
View Public Profile
 
Old 09-19-2010, 07:49 PM Re: Sending Forms to Email
chrishirst's Avatar
Missing! presumed drunk.

Posts: 42,384
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
The PHP section of code should have a ?> as a closing tag

So

PHP Code:
}
else {
echo 
"ERROR";
}
?> 
__________________
Chris. ->>
Please login or register to view this content. Registration is FREE
<<-

A foolish consistency is the hobgoblin of little minds
Thought for today:- Is SEO the only industry where all the cowboys are Indians?
chrishirst is offline
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Reply     « Reply to Sending Forms to Email
 

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.28451 seconds with 12 queries