Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Javascript > Writing a PHP and Javascript generated page to a PHP variable...

Reply
Thread Tools

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

 
 
jonnyblazed@gmail.com
Guest
Posts: n/a
 
      09-03-2006
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

 
Reply With Quote
 
 
 
 
Jerry Stuckle
Guest
Posts: n/a
 
      09-03-2006
http://www.velocityreviews.com/forums/(E-Mail Removed) 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.
(E-Mail Removed)
==================
 
Reply With Quote
 
 
 
 
onembk
Guest
Posts: n/a
 
      09-04-2006
On 2006-09-03 07:46:32 -0600, Jerry Stuckle <(E-Mail Removed)> said:

> (E-Mail Removed) 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.

 
Reply With Quote
 
frothpoker
Guest
Posts: n/a
 
      09-04-2006
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.


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
PHP Training Institute In Delhi, Live Projects on PHP. Short TermPHP Courses, PHP Scripts, PHP Training with Live Projects. Rajive Narain Java 0 09-18-2009 10:47 AM
getting javascript-generated input element values with POST (php) Ben Brown Javascript 2 01-25-2008 10:56 PM
Generated JavaScript vs. Manually Created JavaScript: Which one comes first? Nathan Sokalski ASP .Net 4 11-08-2007 07:24 AM
Validate your html forms with javascript and php with a simple php class __ Javascript 1 10-02-2007 11:06 AM
php generated html needs simple javascript function, yet my javascriptsux mk Javascript 5 07-28-2006 07:21 AM



Advertisments