Posted by John McClumpha on 10/10/14 11:32
On Sat, 19 Nov 2005 13:17:53 +0100, "Stefan Mueller"
<seekware-remove-@yahoo.com> wrote:
>>>I've an input box like
>>> <input type = "hidden" name = "MyBox" value = "">
>>>
>>>Now I'd like to add some text to this input box with PHP.
>>>How can I do that?
>>
>> <input type = "hidden" name = "MyBox" value = "<? echo $MyValue; ?>">
>
>Actually I'm looking for a solution to add some text to an input box which
>already exists.
>In JavaScript I do it with
> document.MyForm.MyBox.value = "some text";
>
>But how can I do that within PHP?
that's a bit of a paradox.... remember PHP "happens" *before* the page
is rendered in a browser (all server side - hence it's called
Hypertext *PRE*processor) - so short of reloading (or should that be
recreating?) the page to acheive this - PHP is not your solution
>PS: To transfer the content of a PHP variable to a JavaScript variable with
> $MyJSVariable = <?echo $MyPHPVariable; ?>
>doesn't work. Mozilla Firefox's JavaScript Console says syntax error at '<?'
>I've to do that within JavaScript. Correct? I'm a little bit surprised why
>your JavaScript variable has a '$' at the beginning.
ignore the name of the javascript variable - it was pseudo code and
purely indicative.... are you testing this on a server that is
correctly processing the php or locally? - as mentioned above php is a
server side technology so testing locally this won't work... if
testing on a server then firefox shouldn't even see the "<?" as it
will have been processed and actioned before anything reaches firefox
--
John McClumpha
Darkness Reigns - http://www.incitegraphics.com.au/darkness/
Navigation:
[Reply to this message]
|