473,503 Members | 2,163 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

PHP Code Pop-up...

7 New Member
I am currently working on a form that would have multiple fields plus an upload file spot. I cannot add the code for the upload file. Also, after clicking submit the form should send an email to the specified email address and currently those emails are not being recieved. All that happens is the php code box ocomes up and lets the user know that the form has been submitted and doesn't re-direct to the thank you page..Please help

Here is my php formmail code...

<?
///////////////////////////////////////////////////////////////////
// PERFECT //
///////////////////////////////////////////////////////////////////

// Configuration Settings
$SendFrom = "sales@lantekonline.com";
$SendTo = "ayob@lantekonline.com";
$SubjectLine = "Feedback Submission";
$ThanksURL = "http://www.lantekonline.com/html/asset_thankyou.htm"; //confirmation page
$Divider = "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~";

// Build Message Body from Web Form Input
$MsgBody = @gethostbyaddr($_SERVER["REMOTE_ADDR"]) . "\n$Divider\n";
foreach ($_POST as $Field=>$Value)
$MsgBody .= "$Field: $Value\n";
$MsgBody .= "$Divider\n" . $_SERVER["HTTP_USER_AGENT"] . "\n";
$MsgBody = htmlspecialchars($MsgBody); //make content safe

// Send E-Mail and Direct Browser to Confirmation Page
mail($SendTo, $SubjectLine, $MsgBody, "From: $SendFrom");
header("Location: $ThanksURL");
?>
Jan 29 '07 #1
5 1992
Motoma
3,237 Recognized Expert Specialist
I am currently working on a form that would have multiple fields plus an upload file spot. I cannot add the code for the upload file. Also, after clicking submit the form should send an email to the specified email address and currently those emails are not being recieved. All that happens is the php code box ocomes up and lets the user know that the form has been submitted and doesn't re-direct to the thank you page..Please help

Here is my php formmail code...

<?
///////////////////////////////////////////////////////////////////
// PERFECT //
///////////////////////////////////////////////////////////////////

// Configuration Settings
$SendFrom = "sales@lantekonline.com";
$SendTo = "ayob@lantekonline.com";
$SubjectLine = "Feedback Submission";
$ThanksURL = "http://www.lantekonline.com/html/asset_thankyou.htm"; //confirmation page
$Divider = "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~";

// Build Message Body from Web Form Input
$MsgBody = @gethostbyaddr($_SERVER["REMOTE_ADDR"]) . "\n$Divider\n";
foreach ($_POST as $Field=>$Value)
$MsgBody .= "$Field: $Value\n";
$MsgBody .= "$Divider\n" . $_SERVER["HTTP_USER_AGENT"] . "\n";
$MsgBody = htmlspecialchars($MsgBody); //make content safe

// Send E-Mail and Direct Browser to Confirmation Page
mail($SendTo, $SubjectLine, $MsgBody, "From: $SendFrom");
header("Location: $ThanksURL");
?>
Files are accessed via the $_FILES variable (much like $_POST and $_GET).
In order to send mail, you will need to have your server configured to do so.
A header("Location:") call will not work if anything gets printed or echoed to the web-browser.
Jan 29 '07 #2
LANTEK
7 New Member
Files are accessed via the $_FILES variable (much like $_POST and $_GET).
In order to send mail, you will need to have your server configured to do so.
A header("Location:") call will not work if anything gets printed or echoed to the web-browser.


How can I do that? Here is the form I am trying to work with, if it helps
[HTML]<form action="formmail.php" method="POST">
<input type="hidden" name="recipient" value="ayob@lantekonline.com">
<input type="hidden" name="subject" value="Asset Investment Form">
<input type="hidden" name="thanks" value="http://www.lantekonline.com/html/asset_thankyou.htm" />
<input type="hidden" name="required" value="email,realname">
<input type="hidden" name="alias" value="email=E-mail Address,realname=Name">
<input type="hidden" name="alias_method" value="email">
<input type="hidden" name="mail_newline" value="2">
<input type="hidden" name="env_report" value="REMOTE_HOST,REMOTE_ADDR">
<input type="hidden" name="print_blank_fields" value="true">
<input type="hidden" name="gmt_offset" value="-5">

<table align="center" width="535" cellspacing="2" cellpadding="5" border="1" height="254">
<tr>
<td width="133" height="2" align="right"><font color="6e2f32" face="Alps">Name:</font></td>
<td width="370" height="2" align="left"><input type="Text" name="realname" align="LEFT" size="35" maxlength="100">
</td>
</tr>
<tr>
<td align="right"><font color="6e2f32" face="Alps">Email: </font></td>
<td align="left"><input type="Text" name="email" align="RIGHT" size="35" maxlength="100">
</td>
</tr>
<tr>
<td align="right"><font color="6e2f32" face="Alps">Title: </font></td>
<td align="left"><input type="Text" name="title" align="RIGHT" size="35" maxlength="100">
</td>
</tr>
<tr>
<td align="right" height="4"><font color="6e2f32" face="Alps">Company:</font></td>
<td align="left" height="4"><input type="Text" name="company" size="35" maxlength="100" >
</td>
</tr>
<tr>
<td align="right" height="4"><font color="6e2f32" face="Alps">Address:</font></td>
<td align="left" height="4"><input type="Text" name="Address" align="LEFT" size="35" maxlength="100">
</td>
</tr>
<tr>
<td align="right" height="4">&nbsp;</td>
<td align="left" height="4"><input type="Text" name="Address2" align="LEFT" size="35" maxlength="100">
</td>
</tr>
<tr>
<td align="right"><font color="6e2f32" face="Alps">City, State Zip: </font></td>
<td align="left"><input type="Text" name="city" align="LEFT" size="25" maxlength="75">
&nbsp;&nbsp;&nbsp;
<input type="Text" name="State" align="LEFT" size="2" maxlength="2">
&nbsp;&nbsp;&nbsp;
<input type="Text" name="Zip" align="LEFT" size="5" maxlength="10">
</td>
</tr>
<tr>
<td align="right"><font color="6e2f32" face="Alps">Phone: </font></td>
<td align="left"><input type="Text" name="phone" align="LEFT" size="15" maxlength="15">
&nbsp;&nbsp;&nbsp; </td>
</tr>
<tr>
<td align="right"><font color="6e2f32" face="Alps">Fax: </font></td>
<td align="left"><input type="Text" name="fax" align="LEFT" size="15" maxlength="15">
&nbsp;&nbsp;&nbsp; </td>
</tr>
</table>
<table width="535" border="1" align="center" cellpadding="5" cellspacing="2">
<tr>
<td colspan="2"><font color="6e2f32" face="Alps">Please provide an approximate asset inventory: </font></td>
</tr>
<tr>
<td width="287" height="202"><p><font color="6e2f32" face="Alps"><br>
Manufacturer(s), Model(s), Quantity, Specifications(If possible): <br>
</font></p>
<p><font color="6e2f32" face="Alps">Do you currently have a PC Refresh Plan?(If yes, how many years?)<br>
<br>
If you have a pre-existing file containing this information, please upload it here</font></p></td>
<td width="242"><p>
<textarea name="manufacturer_model_Quantity_spec"></textarea>
</p>
<p> <font color="6e2f32" face="Alps">
<input name="yes_no" type="Text" size="4" maxlength="4">
<input name="Years" type="Text" id="Years" size="10" maxlength="10">
</font><br>

<br>
</p>
<p> <input type="file" name="upload">
</p></td>
</tr>
</table>
<font color="#0000A0"><BR>
</font>
<DIV align="center">
<INPUT name="submit" type="submit" value="Submit">
</DIV>
</form>[/HTML]
Jan 29 '07 #3
Motoma
3,237 Recognized Expert Specialist
This link explains file uploads in PHP.
Jan 29 '07 #4
LANTEK
7 New Member
So if i understand that correctly, i need to use 2 form tags for this script?
Jan 29 '07 #5
Motoma
3,237 Recognized Expert Specialist
So if i understand that correctly, i need to use 2 form tags for this script?
No, you will need to set your form's ENCTYPE properly, and access your file through the $_FILES variable.
Jan 29 '07 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

3
2875
by: christopher diggins | last post by:
I am considering writing a code generator which takes interfaces specifications in the following style: interface IStack<class Elem_T> invariant: // number of items pushed >= number of items...
2
4003
by: AshifToday | last post by:
Expression Evaluation in Post-Fix Notation Using Stack ===================== /* This program has been made by Ashif Zubair. Roll # 1468, B.Sc.(Hons.) in C.S. ALL RIGHTS ARE RESERVED TO ASHIF...
13
2940
by: Terry Andersen | last post by:
Could anyone please help me understand what is going on in the code below. A short explanation would be nice..... Best Regards Terry struct mystruct { unsigned char testchar; unsigned short...
2
3216
by: LordBlue | last post by:
Hi, please forgive me if i'm sending this post in the wrong place, and please don't tell me to post it in another group, because if i found a better one i'd have already done it. I'm writing a...
16
2269
by: Fronsac | last post by:
Hi, I've been asked in a job interview how to make C code look like C++ code, and honestly I didn't know what to answer because I have never really done a lot of C. Now, I've been searching around...
41
7470
by: Seth | last post by:
I am in need of source code for the Aho Corasick algorithm. I have tried searching the web but can't seem to find any code. Is there a good site for c code I can search? Thanks in advance.
143
7925
by: suri | last post by:
Hello I downloaded glibc and tried looking for the code that implements the sine function i couldnt find the file. i went to the math directory and found math.h.. i guess that needs to be...
46
2433
by: Profetas | last post by:
Hi, I know that this is off topic. but I didn't know where to post. Do you comment your source code while coding or after coding. for example: you write a procedure and after it is...
1
2203
by: GAOZH | last post by:
I wrote below code to do calculation. But it donesn't work for negative numbers like if input 4 + ( - 5 ), the program will crash. Any one can help me to modify the code to make it can calculate...
3
3576
by: Chris288 | last post by:
Hi, I have a problem where our app when compiled in VS2005 runs about 50% the speed it attains in VS2003. This is an unmanaged C++ app. I have tried most combinations of the optimization and...
0
7205
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7287
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7353
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
7468
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5596
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
4689
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3170
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
747
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
401
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.