I made a form, but when i send page by email, all variables are lost

Hello, I thought this would have been so simple…
In the past I always have manually created an email that I sent to active customers about sales etc… I put my company banner on the email etc… But it always took a long time to set up, So i figured I would just create an automated one online. I created a form that asked for basic info like “header”, paragraph 1, paragraph 2, closing sentence… then i had it post to a webpage that was set up like a template… I alreday had my banner, my contact info, another little image, and then I would just post the content from the form.

well, it worked, I mean I can view all the fields in my online webpage… BUT wen i select the option in the browser to “send page by email”, it puts everything in the email nicely formatted etc EXCEPT for my posted variable… so basically I get an email that has my banner, and image etc, but its missing the content that the form passed over to the page.

QUESTION: so does anyone know some other workaround for this or something?

oh well i hope so, i spent so much time making it look all nice, lol.

If it’s getting from the form to the page, then the code that gets the variable for the page is OK. Do you use similar code for the email creating/sending file?

I dont even use any code after that. I just simply went to my browser:
Page/Send Page By Email

it pulls the page into my outlook.
I can do this method with any random webpage and it works,

and it almost works with mine, it pulls the entire page in correctly, but it leaves the variables out.

When you select the option in the browser to “send page by email”, it has not a single bit of relation to this forum topic.
You better ask in the browser related section.
Or use PHP to email this info, although it goes to be more complicated

I do actually think it has something to do with php. Because when a page is totally html then im able to send entire page to outlook. however, when some php varaiables are involved, only the html goe sto outlook and my variables are missing…

Let me know if you guys want me to still post in a browser section and i will.

I am little confused with this feature. Where and how did you implement this feature? The following line makes me confused.

BUT wen i select the option in the browser to “send page by email”…

Do you mean you have a form and button having label/value as “send page by email”? What script is sending the emails actually? If you have access the script/code that sends the emails better let us see that script because that script should have manipulated the variables like replacing those variables with some real values or so.

There is no PHP in your browser.
the result of PHP script executing is plain HTML, that being sent to the browser.
So, you got to create proper HTML with your script.

I made it more confusing than it is…
I created 2 files…
(1) a very basic form (form.php)

Its handled by my second page:
(2) form2.php

form2.php shows all of the variables that were passed to it… the from works correctly…

Then I use IE’s ‘Send page by email’ feature, so that I can email the webpage results…
Outlook opens up automatically and the webpage appears in a new email ready to be sent… the problem is that the php variables are not in the email… everything else is… the banner, the tabels, image, etc… just the php variables are missing - which is odd since they are dispalyed in the form2.php page correctly…

so basicaly, my email says “name:” but then its blank, theers no name…

oh ok, well thats actually one of the things i was wodnering about…
should i just giev up with method of trying to send a quick email… or is tehre a way to convert the php variables to html so that the browser could send it to outlook?

Your goal is very simple and consists of 2 steps:

Step One:
Create a primer of your page. HTML page. Test if it sends correctly.

Step Two:
Create the same HTML using PHP from the form variables. Ensure yo’ve got the same HTML as from step One

Done.
From now your script works perfectly

is tehre a way to convert the php variables to html

PHP variable can be converted to ANY text. Including HTML text
The only thing you got to know - what HTML you want!

so if php executes, and then is plain html, how come it wont display in outlook with all the rest of the html?

my php is very basic… just a regular echo statement.

<p><font face="Arial, Helvetica, sans-serif" size="2" color="#000000"><?php echo $nlclosing1; ?></font></p>

sorry, we posted at same time… yes thats exactly my point, the code is working great. just the browser isnt pulling it with the rest of html to outlook…

ok im probably starting to annoy people in here with back to back posts… ill just consider it a dead issue… it just doesngt make sinse though. cause i didnt do any crazy programming. just basic asking for name, etc…

well thanks for the help anyway
:slight_smile:

I told you already. Your question has no relation to PHP.
2 steps. Remember?

Step One.
<p><font face=“Arial, Helvetica, sans-serif” size=“2” color=“#000000”>blah blah blah</font></p>
Send it.
If displays ok - Go for the step 2.
If not - check your HTML

Step Two:
<p><font face=“Arial, Helvetica, sans-serif” size=“2” color=“#000000”><?php echo $nlclosing1; ?></font></p>
Check your browser’s “show source” feature if your HTML match previous example
If match - you’re ok
If not - correct PHP code to match

VERY simple. No crazy programming needed

You said that you get the PHP on the second page from a form in the first page so shouldn’t the echo statement have $_GET / $_POST when your echoing it on the second page?

yes, it does, I grabbed that at the beginning of the file

<?php 
$nldateMonth = $_POST['nldateMonth'];
$nldateYear = $_POST['nldateYear'];
$nldateDay = $_POST['nldateDay'];
$nlheader1 = $_POST['nlheader1'];
$nlparagraph1 = $_POST['nlparagraph1'];
$nlparagraph2 = $_POST['nlparagraph2'];
$nlclosing1 = $_POST['nlclosing1'];
$nlphone = $_POST['nlphone'];
?>

Oh you mean you can see the PHP code itself in form2.php page? Or you have posted values in the form itself:


<p><font face="Arial, Helvetica, sans-serif" size="2" color="#000000"><?php echo $nlclosing1; ?></font></p>

Or


<p><font face="Arial, Helvetica, sans-serif" size="2" color="#000000">The value entered fro that variable</font></p>

?

This may complicate things for you initially but in the long term it would be easier but why not just send the form data straight through the mail function built into PHP?

Your host should have the mail function enabled and you can do it automatically without involving IE or any other browser.

raw mail() wont’ help him, because of 2 reasons

  1. He has a rich HTML emails. including pictures. It’s hard as hell to compose it using just mail function even to a seasoned programmer. Some library is only solution, but still need hardwork to set up
  2. Some unknown error must be eliminated first. As mail() can fail the same way as browser does

If he can go for PHP to send the emails then i would recommend to try once PHPMailer. It is really easier to send the emails.

Just so I get this straight.

  • Form sends $_POST input values to a PHP generated HTML page.
  • That page shows all variable values (and additional images) OK
  • When you use IE to “send as” everything is included in the email except that one variable value.

I’m wondering if it’s an IE thing. If you hard-code some text where that variable is now, is it still omitted? That is, is IE not including it because it’s generated from PHP, or does it have a problem with the tags/attributes it’s nested in?