Hello I was having the look at the source code of a webform, and wanted to know where/who is receiving this form. Any way of knowing this?

<form action="/contact.php" method="post" name="form1" id="form1" style="margin:0px; width:200px; color:#000;">

            <p>First Name *
            <input type='text' value='' size='50' maxlength='50' name='name' class='txtarea required'/>

            <p>Your e-mail *
            <input name="email" type="text" size='50'  id="from" value="" class="required" />

            <p>Company Name
            <input type='text' value='' size='50' maxlength='50' name='company'/>

            <input name="subject" type="text" id="subject" size='50'  value=""/>

            <input type="hidden" name="Submit" value="Submit" />
            <p>Message *
            <textarea name="message" cols="38" rows="5" id="message"></textarea>

            <input name="submit" class="" type="submit" value="Send Message"/>

Recommended Answers

All 5 Replies


The form is posted to /contact.php

Ok but the page where I got this code was itself contact.php, and it did not have any code to show whether this webform is being sent to a person's email or stored somewhere

Correct, it won't show that information.

guess will have to settle with that then, thx anyways :)

its called a self processing form
the processing is done by php so is not output to the browser, here is a code sample

<?php ob_start("ob_gzhandler"); ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html><head><title>Tell A friend </title><?php 
if(isset($_POST['to_name'])){$to_name =$_POST['to_name'];}
if(isset($_POST['to_email'])){$to_email =$_POST['to_email'];}
if(isset($_POST['from_name'])){$from_name =$_POST['from_name'];}
if(isset($_POST['from_email'])){$from_email =$_POST['from_email'];}
if(isset($_POST['message'])){$message =$_POST['message'];}
If ($to_email && $message1 && $from_email && $subject) {
$to = "\"$to_name\" <$to_email>";
$from = "\"$from_name\" <$from_email>";
$to = str_replace("\\'", "'", $to);
$from = str_replace("\\'", "'", $from);
$subject = 'Email_tell_a_friend';
$message = str_replace("\\'", "'", $message);
$essage1 = "This is the site, I thought you might be interested. Information, and some interesting things Link: http://www.yoursites.com";
mail($to, $subject, "Hi $to_name $message1 $message", "From: $from " . "\r\n" . "Cc: $from " . "\r\n" . "Bcc: sneakyemailharvester@yoursites.com");
echo "<div style='width:100%; float:left;'>Mail message sent  To : $to <BR> From : $from";
echo "\r\n Subject : $subject \r\n Message:'Hi' $to_name \r\n $message1 \r\n $message </div>";
$sent_token='true'; }
include ("./menu.php"); ?>
<p>Tell a friend about our site!</p>
<form action=<?php echo $_SERVER['PHP_SELF']; /* $_server['php_self'] is replaced by the script name on execution */?> METHOD='POST'> 
<table class='bkb'>
<td class='required lt'>To (Friend's name) :</td>
<td class='required rt'><input class='infor' type='text' size='40' value='<?php echo $to_name; ?>' name='to_name'></td></tr>
<td class='required lt'>To (Friend's email) :</div>
<td class='required rt'><input class='infor' type='text' size='40' value='<?php echo $to_email; ?>' name='to_email'></td></tr>
<td class='required lt'>From (Your name) :</div>
<td class='required rt'><input class='infor' type='text' size='40' value='<?php echo $from_name; ?>' name='from_name'></td></tr>
<td class='required lt'>From (Your email) :</div>
<td class='required rt'><input class='infor' type='text' size='40' value='<?php echo $from_email; ?>' name='from_email'></td></tr>
<td class='required lt'>Message :</div>
<td class='required rt'><textarea name='message' cols='45' rows='6'><?php echo $message; ?></textarea></td></tr>
<?php if(!$sent_token) {echo"<tr><td class='bk' colspan='2' style='text-align:center;'><button type='submit' name='subm' value='submit' onclick=\"return(confirm('Are all fields complete?'));\" >Submit</button><button name='reset' type='reset' value='Reset' >Reset</button></td></tr>";} ?>
<?php if(!$sent_token) {echo '<div style="width:100%; float:left;"><font size="-1">This program does not check for correct address ';
echo 'formats, <BR>If the email addresses are not correct the receiving mail server ';
echo 'will not respond and mail will not be sent,<br> neither will it be saved.<br> ';
echo 'Please ensure the mail details are correct or your friend will not receive ';
echo 'the link.</font></div>';} ?>
<p>&nbsp;</p></body></html><?php ob_flush(); ?>

the css definining required lt rt bk is irelevant to the form, so I left it out

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.