April 29th, 2001, 05:20 AM
I've got the following problem:
BUT: I can't tell my JS function to write the PHP-begin and end-tags ("<?php" and "?>"), because this script is placed in a .php file and when the parser sees this <?php it thinks now it shall interprete the following code.
document.form.generated_code.value = "<?php echo('Hello " + document.form.text + "! ') ?>";
How can my JS script generate PHP code???
April 29th, 2001, 05:42 AM
Try replacing the
That should work.
Last edited by R0bb02001; April 29th, 2001 at 05:44 AM.
April 29th, 2001, 06:04 AM
Hope I am right
Last edited by Nikjazz; April 29th, 2001 at 06:15 AM.
April 29th, 2001, 06:11 AM
From what Filip explained I thought that he was saying (I may be wrong) that the php code is not parsed, its just put into a textarea box in a form, which then the user can copy or whatever...
April 29th, 2001, 06:12 AM
Sorry, if this wasn't clear (my english...)
The script only should be create the PHP code and put in this <textarea>, the code should not be executed after it was generated, only the user can copy the code and put in in his files.
@R0bb...: I just tried it with < and > but then the JS script inserts really "<" and ">" in the <textarea>, not the wanted "<" and ">".
But thanks anyways!
April 29th, 2001, 06:13 AM
This is really paralled work! We are just two different processes.... ;-)
April 29th, 2001, 06:14 AM
You could split the tags:
document.form.generated_code.value = "<" + "?php echo('Hello " + document.form.text + "! ') ?" + ">";
April 29th, 2001, 06:18 AM
yeah this should work - but the "<" thing should work to - did ya put it into "<" ? not '<' I am not really shure now since i didn't try it - but who knows...
April 29th, 2001, 06:29 AM
This really does it!
A really easy solution!
April 29th, 2001, 06:32 AM
Nah Nikolai, I was thinking it was about 50-50 as to wether using > etc. would work because a textarea form is not parsed by your browser.
I mean, the > is parsed by the browser and converted into > when it sees it in PHP, but a form box is not processed as HTML.
The more I think about it, the more stupid I feel for thinking that it may work