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
Help needed to modify contact form
Old 03-13-2009, 03:56 AM Help needed to modify contact form
grownupstudent's Avatar
Experienced Talker

Posts: 48
Name: Jono
Location: Ireland
Trades: 0
Hello
I need someone to tell me hot to modify the contact form below so that it can give me these details when a user fills out the form,

- Domain name
- cpanel username
- IP
- Message

what I think I need changed is, how to change your name in script to domain name, Put in another process or whatever its called for cpanel username, It gives me the IP and message allready so they are ok here is the script that has two seperate files

PHP Code:
<?php
$ipi 
getenv("REMOTE_ADDR");
$httprefi getenv ("HTTP_REFERER");
$httpagenti getenv ("HTTP_USER_AGENT");
?>

<input type="hidden" name="ip" value="<?php echo $ipi ?>" />
<input type="hidden" name="httpref" value="<?php echo $httprefi ?>" />
<input type="hidden" name="httpagent" value="<?php echo $httpagenti ?>" />
HTML Code:
Your Name: <br />
<input type="text" name="visitor" size="35" />
<br />

<br />
Your Email:<br />
<input type="text" name="visitormail" size="35" />

<br /><br />
Mail Message:
<br />
<textarea name="notes" rows="4" cols="40"></textarea>
<br />
<input type="submit" value="Send Mail" />
</form>
And heres the second file

PHP Code:
<?php

$ip 
$_POST['ip'];
$httpref $_POST['httpref'];
$httpagent $_POST['httpagent'];
$visitor $_POST['visitor'];
$visitormail $_POST['visitormail'];
$notes $_POST['notes'];
$attn $_POST['attn'];


if (
eregi('http:'$notes)) {
die (
"Do NOT try that! ! ");
}
if(!
$visitormail == "" && (!strstr($visitormail,"@") || !strstr($visitormail,".")))
{
echo 
"<h2>Use Back - Enter valid e-mail</h2>\n";
$badinput "<h2>Feedback was NOT submitted</h2>\n";
echo 
$badinput;
die (
"Go back! ! ");
}

if(empty(
$visitor) || empty($visitormail) || empty($notes )) {
echo 
"<h2>Use Back - fill in all fields</h2>\n";
die (
"Use back! ! ");
}

$todayis date("l, F j, Y, g:i a") ;

$attn $attn ;
$subject $attn;

$notes stripcslashes($notes);

$message $todayis [EST] \n
Attention: 
$attn \n
Message: 
$notes \n
From: 
$visitor ($visitormail)\n
Additional Info : IP = 
$ip \n
Browser Info: 
$httpagent \n
Referral : 
$httpref \n
"
;

$from "From: $visitormail\r\n";


mail("ireland@yahoo.com"$subject$message$from);

?>

<p align="center">
Date: <?php echo $todayis ?>
<br />
Thank You : <?php echo $visitor ?> ( <?php echo $visitormail ?> )
<br />

Attention: <?php echo $attn ?>
<br />
Message:<br />
<?php $notesout str_replace("\r""<br/>"$notes);
echo 
$notesout?>
<br />
<?php echo $ip ?>
Any help with this would be greatly appreaciated
thanks
grownupstudent

Last edited by grownupstudent; 03-13-2009 at 06:57 AM..
grownupstudent is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 03-13-2009, 08:59 AM Re: Help needed to modify contact form
Defies a Status

Posts: 1,606
Trades: 0
Quote:
Your Name: <br />
<input type="text" name="visitor" size="35" />
<br />
Your Name is the field prompt.
name="visitor"visitor= the fied name each must be unique

Add as many as you like and modify the receivor portion to accept them in the same manner:

$newname = $_POST['newname'];

Then add the new items to the send part:

mail("ireland@yahoo.com", $subject,$newname, $message, $from);

That ought to get you started.








__________________
Colbyt

Please login or register to view this content. Registration is FREE
colbyt is offline
Reply With Quote
View Public Profile
 
Old 03-13-2009, 09:03 AM Re: Help needed to modify contact form
grownupstudent's Avatar
Experienced Talker

Posts: 48
Name: Jono
Location: Ireland
Trades: 0
I had been playing around with it and kind of realized the first bit you said but when I tested it I did'nt receive the input from the new field because I did'nt know how to modify the part after the email address.

Excellent thanks for the reply,
I'll give it a go.

I tryed this an it did'nt work any suggestions what might be wrong?

PHP Code:
<?php
$ipi 
getenv("REMOTE_ADDR");
$httprefi getenv ("HTTP_REFERER");
$httpagenti getenv ("HTTP_USER_AGENT");
?>

<input type="hidden" name="ip" value="<?php echo $ipi ?>" />
<input type="hidden" name="httpref" value="<?php echo $httprefi ?>" />
<input type="hidden" name="httpagent" value="<?php echo $httpagenti ?>" />
<input type="hidden" name="domain" value="<?php echo $domain ?>" />
HTML Code:
Your Name: <br />
<input type="text" name="visitor" size="35" />
<br />
Domain Name: <br />
<input type="text" name="domain" size="35" />
<br />
Your Email:<br />
<input type="text" name="visitormail" size="35" />

<br /><br />
Mail Message:
<br />
<textarea name="notes" rows="4" cols="40"></textarea>
<br />
<input type="submit" value="Send Mail" />
</form>
PHP Code:
<?php

$ip 
$_POST['ip'];
$httpref $_POST['httpref'];
$httpagent $_POST['httpagent'];
$visitor $_POST['visitor'];
$visitormail $_POST['visitormail'];
$notes $_POST['notes'];
$attn $_POST['attn'];
$domain $_POST['domain'];

if (
eregi('http:'$notes)) {
die (
"Do NOT try that! ! ");
}
if(!
$visitormail == "" && (!strstr($visitormail,"@") || !strstr($visitormail,".")))
{
echo 
"<h2>Use Back - Enter valid e-mail</h2>\n";
$badinput "<h2>Feedback was NOT submitted</h2>\n";
echo 
$badinput;
die (
"Go back! ! ");
}

if(empty(
$visitor) || empty($visitormail) || empty($notes )) {
echo 
"<h2>Use Back - fill in all fields</h2>\n";
die (
"Use back! ! ");
}

$todayis date("l, F j, Y, g:i a") ;

$attn $attn ;
$subject $attn;

$notes stripcslashes($notes);

$message $todayis [EST] \n
Attention: 
$attn \n
Message: 
$notes \n
From: 
$visitor ($visitormail)\n
Additional Info : IP = 
$ip \n
Browser Info: 
$httpagent \n
Referral : 
$httpref \n
"
;

$from "From: $visitormail\r\n";


mail("ireland@yahoo.com"$subject$domain$message$from);

?>

<p align="center">
Date: <?php echo $todayis ?>
<br />
Thank You : <?php echo $visitor ?> ( <?php echo $visitormail ?> )
<br />

Attention: <?php echo $attn ?>
<br />
Message:<br />
<?php $notesout str_replace("\r""<br/>"$notes);
echo 
$notesout?>
<br />
<?php echo $ip ?>

Last edited by grownupstudent; 03-13-2009 at 09:42 AM..
grownupstudent is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to Help needed to modify 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.12452 seconds with 12 queries