473,396 Members | 1,772 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Writing a PHP and Javascript generated page to a PHP variable...

Okay..... I'm gonna sum up what I want to do cause it will make it
pretty simple for you guys to understand.

Here we go:
I have a form that posts data to a PHP mailer page I have created. When
it goes to the PHP mailer page it reads some of the data and modifies
the page accordingly using Javascript (hiding certain divs, etc...). My
goal, is to take all this data after it has been processed by
Javascript and send it through my PHP mailer as it is currently
formatted.

If it helps any, the track I am on right now involves encapsulating the
Javascript processed block in a div. I am then trying to take the
..innerHTML data from that div and store it in the PHP $message variable
for my mailer. This won't work because PHP is server side. So, I moved
on to generate some Javascript code (with PHP) that sends all that
messy HTML data that its processed through a URL variable to then be
read by PHP. This doesn't really accomplish what I want as it cuts off
about a quarter of the way through my data......

Any ideas??

One thing I thought of but don't know how to do or whether it's even
possible is using PHP to view the source of the current page and store
that as the HTML to be e-mailed. Or, is it possible to do something
similar to .innerHTML with PHP?
Well, Thanks in advance everyone! I've been up for the past 4 hours
trying to figure this out and I rarely post on message boards. You guys
are my last hope before I'm forced to settle for sending the text
unformatted and messy :(

Sep 3 '06 #1
3 3955
jo*********@gmail.com wrote:
Okay..... I'm gonna sum up what I want to do cause it will make it
pretty simple for you guys to understand.

Here we go:
I have a form that posts data to a PHP mailer page I have created. When
it goes to the PHP mailer page it reads some of the data and modifies
the page accordingly using Javascript (hiding certain divs, etc...). My
goal, is to take all this data after it has been processed by
Javascript and send it through my PHP mailer as it is currently
formatted.
And what happens if the user has js disabled?
If it helps any, the track I am on right now involves encapsulating the
Javascript processed block in a div. I am then trying to take the
.innerHTML data from that div and store it in the PHP $message variable
for my mailer. This won't work because PHP is server side. So, I moved
on to generate some Javascript code (with PHP) that sends all that
messy HTML data that its processed through a URL variable to then be
read by PHP. This doesn't really accomplish what I want as it cuts off
about a quarter of the way through my data......

Any ideas??
Forget the js. Do your work server-side.
One thing I thought of but don't know how to do or whether it's even
possible is using PHP to view the source of the current page and store
that as the HTML to be e-mailed. Or, is it possible to do something
similar to .innerHTML with PHP?
Nope. As you noted, PHP is server side, not client side.
>
Well, Thanks in advance everyone! I've been up for the past 4 hours
trying to figure this out and I rarely post on message boards. You guys
are my last hope before I'm forced to settle for sending the text
unformatted and messy :(
No, it's not possible to view the source with PHP. However, you
generated the source - so you should know what it is. And you can
buffer your output - see ob_start(), etc. - and use it later.

Not knowing exactly what you're trying to do, it's impossible to say if
you're on the right track or not. But it seems to be needlessly
complicated.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================
Sep 3 '06 #2
On 2006-09-03 07:46:32 -0600, Jerry Stuckle <js*******@attglobal.netsaid:
jo*********@gmail.com wrote:
>Okay..... I'm gonna sum up what I want to do cause it will make it
pretty simple for you guys to understand.

Here we go:
I have a form that posts data to a PHP mailer page I have created. When
it goes to the PHP mailer page it reads some of the data and modifies
the page accordingly using Javascript (hiding certain divs, etc...). My
goal, is to take all this data after it has been processed by
Javascript and send it through my PHP mailer as it is currently
formatted.

And what happens if the user has js disabled?
>If it helps any, the track I am on right now involves encapsulating the
Javascript processed block in a div. I am then trying to take the
.innerHTML data from that div and store it in the PHP $message variable
for my mailer. This won't work because PHP is server side. So, I moved
on to generate some Javascript code (with PHP) that sends all that
messy HTML data that its processed through a URL variable to then be
read by PHP. This doesn't really accomplish what I want as it cuts off
about a quarter of the way through my data......

Any ideas??

Forget the js. Do your work server-side.
>One thing I thought of but don't know how to do or whether it's even
possible is using PHP to view the source of the current page and store
that as the HTML to be e-mailed. Or, is it possible to do something
similar to .innerHTML with PHP?

Nope. As you noted, PHP is server side, not client side.
>>
Well, Thanks in advance everyone! I've been up for the past 4 hours
trying to figure this out and I rarely post on message boards. You guys
are my last hope before I'm forced to settle for sending the text
unformatted and messy :(

No, it's not possible to view the source with PHP. However, you
generated the source - so you should know what it is. And you can
buffer your output - see ob_start(), etc. - and use it later.

Not knowing exactly what you're trying to do, it's impossible to say if
you're on the right track or not. But it seems to be needlessly
complicated.
I think that part of your problem is that the hidden divs still contain
data. Rather than hiding them, set their innerHTML to an empty string.
As far as the rest, you will need to make sure that the page only
contains the data you want to be part of the email (using JavaScript or
whatever, though I tend agree with Johnny that you should avoid
JavaScript unless you have a built in server-side alternative) before
submitting it to the mailer.

Sep 4 '06 #3
you don't say how much of this page is entered by the user and how much
is 'static' text and how much is generated from a user profile.

Could you store the bits of text you want in the email and on the web
page as either database entries or static text and make your script
simply build the string together from the static text. If you wanted
to, you could build two strings, one for web page display and one for
email display inside a function and simply include the email display
string in the form as a hidden field.

just a thought.

Obiron
JavaScript unless you have a built in server-side alternative) before
submitting it to the mailer.
Sep 4 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

15
by: bengee | last post by:
Hi Does anyone know of a way to edit "live" javascript (that i have no control over) in IE? Example, i visit a website and see a webpage in IE containing Javascript. Can i edit that...
6
by: Steve B. | last post by:
Hello everybody In a webpage, I use JS display data from an xml file and a xsl file: var data = new ActiveXObject("Microsoft.XMLDOM"); data.async = false; var dataUrl = "data.aspx";...
2
by: Kourosh | last post by:
Could anyone point me in the right direction? I have checkboxes on my html page (XSL generated page). When the user clicks on them, I want to filter certain XML tags and hide them. I could hide...
3
by: jonnyblazed | last post by:
Okay..... I'm gonna sum up what I want to do cause it will make it pretty simple for you guys to understand. Here we go: I have a form that posts data to a PHP mailer page I have created. When...
3
by: BAnderton | last post by:
Hello all, Question: Is there any way to access a javascript variable from within psp code? I'm aware of how to do the reverse of this (js_var='<%=psp_var%>'). Here's a non-working...
2
Frinavale
by: Frinavale | last post by:
Hi! I am dynamically generating external .js JavaScript resources to be used with a Tab control I created (using VB.NET). Originally, the JavaScript was written directly into the <head> of the...
2
Frinavale
by: Frinavale | last post by:
JavaScript in ASP.NET Using JavaScript in ASP.NET pages can make your application seem to work faster and prevent unnecessary calls to the server. JavaScript can be used to perform client-side...
4
by: =?Utf-8?B?R1ROMTcwNzc3?= | last post by:
Hi Guys, thanks for your help yesterday, I've got one more question, then I think I'm done for now,... Is it possible to insert recordset data in a javascript, for instance I have a javascript...
9
by: mshepard | last post by:
I am very new to Javascript and would like some advise for the following... a. Declare a variable named rNumber = to the value returned from the randInt() function using 5 as the parameter value. ...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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
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
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
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,...

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.