|
Posted by onembk on 09/04/06 04:08
On 2006-09-03 07:46:32 -0600, Jerry Stuckle <jstucklex@attglobal.net> said:
> jonnyblazed@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.
Navigation:
[Reply to this message]
|