php webform assistance requested (wait, or is it Python?)

Website, internet, technology, and computer resources, discussion and assistance.

php webform assistance requested (wait, or is it Python?)

Unread postby Erdrick » Sun Oct 23, 2011 7:55 pm

Been trying to figure out how to make it work, and a couple days worth of fruitless googling/etc later, yeah, let's try crowdsourcing... Long Story Short, I want to access the "email" data from the webform and have it used as the "FromEmail", so I can see who the email is from, instead of everything being from "myself" or another set address.

Below is the code from the .php file activated by the "post" action; (I can attach the form addy or HTML too, if that would help).


It should be something in the Line #2, (

$fromemail="$_POST['$fieldnm_3']"; // change here if you want

)

Which was just a set addy earlier...


(Yes, the to email is fake :p)

ANYWAY........


Any help is greatly appreciated :o



Code: Select all

<?php ob_start();
$fromemail="$_POST['$fieldnm_3']"; // change here if you want
$toemail="FAKE@FAKE.com";   // change here if you want
$sub="Contact Form";          // change here if you want
$success_page_name="Contact.html";
////// do not change in following
if($_SERVER['REQUEST_METHOD']=="POST")
{
$fieldnm_1=str_replace ( array("\n"), array("<br>"),trim($_REQUEST['fieldnm_1'])); 
$fieldnm_2=str_replace ( array("\n"), array("<br>"),trim($_REQUEST['fieldnm_2'])); 
$fieldnm_3=str_replace ( array("\n"), array("<br>"),trim($_REQUEST['fieldnm_3'])); 
$fieldnm_4=str_replace ( array("\n"), array("<br>"),trim($_REQUEST['fieldnm_4'])); 
$fieldnm_5=str_replace ( array("\n"), array("<br>"),trim($_REQUEST['fieldnm_5'])); 
$fieldnm_6=str_replace ( array("\n"), array("<br>"),trim($_REQUEST['fieldnm_6'])); 
$fieldnm_7=str_replace ( array("\n"), array("<br>"),trim($_REQUEST['fieldnm_7'])); 
$fieldnm_8=str_replace ( array("\n"), array("<br>"),trim($_REQUEST['fieldnm_8'])); 
$fieldnm_9=str_replace ( array("\n"), array("<br>"),trim($_REQUEST['fieldnm_9'])); 
$fieldnm_10=str_replace ( array("\n"), array("<br>"),trim($_REQUEST['fieldnm_10'])); 


$contentmsg=stripslashes("<br><b><font style=color:#CC3300>$sub</font></b><br>
<table width=708 border=0 cellpadding=2 cellspacing=1 bgcolor=#CCCCCC>

<tr>
      <td width=165 align=right valign=top bgcolor=#FFFFFF><B>Title *:</b> </td>
      <td width=565 align=left valign=top bgcolor=#FFFFFF>$fieldnm_1</td>
</tr>

<tr>
      <td width=165 align=right valign=top bgcolor=#FFFFFF><B>Name *:</b> </td>
      <td width=565 align=left valign=top bgcolor=#FFFFFF>$fieldnm_2</td>
</tr>

<tr>
      <td width=165 align=right valign=top bgcolor=#FFFFFF><B>Email *:</b> </td>
      <td width=565 align=left valign=top bgcolor=#FFFFFF>$fieldnm_3</td>
</tr>

<tr>
      <td width=165 align=right valign=top bgcolor=#FFFFFF><B>Subject *:</b> </td>
      <td width=565 align=left valign=top bgcolor=#FFFFFF>$fieldnm_4</td>
</tr>

<tr>
      <td width=165 align=right valign=top bgcolor=#FFFFFF><B>Message *:</b> </td>
      <td width=565 align=left valign=top bgcolor=#FFFFFF>$fieldnm_5</td>
</tr>

<tr>
      <td width=165 align=right valign=top bgcolor=#FFFFFF><B>City :</b> </td>
      <td width=565 align=left valign=top bgcolor=#FFFFFF>$fieldnm_6</td>
</tr>

<tr>
      <td width=165 align=right valign=top bgcolor=#FFFFFF><B>State :</b> </td>
      <td width=565 align=left valign=top bgcolor=#FFFFFF>$fieldnm_7</td>
</tr>

<tr>
      <td width=165 align=right valign=top bgcolor=#FFFFFF><B>ZIP / Postal Code :</b> </td>
      <td width=565 align=left valign=top bgcolor=#FFFFFF>$fieldnm_8</td>
</tr>

<tr>
      <td width=165 align=right valign=top bgcolor=#FFFFFF><B>Country :</b> </td>
      <td width=565 align=left valign=top bgcolor=#FFFFFF>$fieldnm_9</td>
</tr>

<tr>
      <td width=165 align=right valign=top bgcolor=#FFFFFF><B>Phone :</b> </td>
      <td width=565 align=left valign=top bgcolor=#FFFFFF>$fieldnm_10</td>
</tr>

</table>
");

////
$headers  = "MIME-Version: 1.0
";
$headers .= "Content-type: text/html; charset=iso-8859-1
";
            
$from=$fromemail;
            
$headers .= "From: ".$from."
";
            
@mail($toemail,$sub,$contentmsg,$headers);
            
            
header("Location:$success_page_name");

}
?>



Last edited by Erdrick on Mon Oct 24, 2011 12:33 am, edited 1 time in total.
Between Mysidian Moments and MizuSoft, I have little time for MeeSelf...
Erdrick
Sage
 
Posts: 294
Joined: Thu Dec 05, 2002 6:54 pm

Re: php webform assistance requested

Unread postby Erdrick » Sun Oct 23, 2011 8:00 pm

(And if this should be rolled into one of the other threads, my bad- just didn't see php listed)
Between Mysidian Moments and MizuSoft, I have little time for MeeSelf...
Erdrick
Sage
 
Posts: 294
Joined: Thu Dec 05, 2002 6:54 pm


Return to Foreign Kingdoms

Who is online

Users browsing this forum: No registered users and 2 guests

Copyright © 2002–2008 Kongming’s Archives. All Rights Reserved

 
cron