Re: Javascript & PHP
| From: | Jochem Maas | Date: | Fri, 16 Jun 2006 09:55:27 +0000 |
| Subject: | Re: Javascript & PHP | ||
| References: | 1 2 3 4 5 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-238147@lists.php.net to get a copy of this message | ||
Rob W. wrote:
> Well for example
>
> when I pull my mysql db variable
>
> $serverid=mysql_result($result,$i,"serverid");
>
> How do I bind it so this ^^ to the java var below?
(I hope english is not you first language - or maybe you
write in shorthand *and* you don't bother to reread what you
have written)
btw it's not JAVA but JAVASCRIPT.
>
> var serverid = serveradd.serverid.value;
have you thought of something like this:
<script type="text/javascript">
<!--
var serverid = <? echo $serverid ?>;
//-->
</script>
>
> - Rob
>
> ----- Original Message ----- From: "Jochem Maas" <jochem@iamjochem.com>
> To: "Rob W." <rob@fiberuplink.com>
> Cc: <php-general@lists.php.net>
> Sent: Friday, June 16, 2006 4:26 AM
> Subject: Re: [PHP] Javascript & PHP
>
>
>> Rob W. wrote:
>>> Well i'm trying to figure out how to bind the php variables to the
>>> javascript variables after I pull them out of the mysql database.
>>
>> something like this? ...
>>
>> $data = getServerTypeDataOrSomething();
>>
>> ?>
>>
>> <form name="serveradd">
>> <input type="text" name="serverid" value="<? echo
>> $data['serverid']; ?>">
>>
>> ... etc
>>
>>
>> or am I missing the point completely?
>>
>>
>>>
>>> - Rob
>>>
>>> ----- Original Message ----- From: "Jochem Maas" <jochem@iamjochem.com>
>>> To: "Rob W." <rob@fiberuplink.com>
>>> Cc: <php-general@lists.php.net>
>>> Sent: Friday, June 16, 2006 4:13 AM
>>> Subject: Re: [PHP] Javascript & PHP
>>>
>>>
>>>> Rob W. wrote:
>>>>> Ok. I am trying to figure out if this would be the correct thing to
>>>>> do. I start off with Java script that looks like this.
>>>>>
>>>>> /*
>>>>> function getType(what,available,owner) {
>>>>> var serverid = serveradd.serverid.value;
>>>>> var cabinetid = serveradd.cabinetid.value;
>>>>> var rowid = serveradd.rowid.value;
>>>>> var dcid = serveradd.dcid.value;
>>>>> var colour = serveradd.colour.value;
>>>>> var spec = serveradd.spec.value;
>>>>> var mainip = serveradd.mainip.value;
>>>>> var oldip = serveradd.oldip.value;
>>>>> var switchid = serveradd.switchid.value;
>>>>> var switchport = serveradd.switchport.value;
>>>>> var apcid = serveradd.apcid.value;
>>>>> var apcport = serveradd.apcport.value;
>>>>> document.location=('admin.php?page=serveradd&action=' +
>>>>> add +
>>>>> '&myid=&serverid=' + serverid + '&cabinetid=' +
>>>>> cabinetid + '&rowid=' + rowid + '&dcid=' + dcid +
>>>>> '&colour=' + colour
>>>>> + '&spec=' + spec + '&mainip=' + mainip +
>>>>> '&oldip=' + oldip + '&switchid=' + switchid +
>>>>> '&switchport=' +
>>>>> switchport + '&apcid=' + apcid + '&apcport=' +
>>>>> apcport +
>>>>> '&available=' + available + '&owner=' + owner);
>>>>> }*/
>>>>>
>>>>> Do I, Before that exec's, add in my mysql get to set the variables to
>>>>> the java variables or how do I enter that in?
>>>>
>>>>
>>>> I read that line 3 times - I know its english, but the meaning escapes
>>>> me... maybe others have the same problem.
>>>> could you rephrase the question?
>>>>
>>>>>
>>>>> Any help is appricated.
>>>>>
>>>>> -Rob
>>>>
>>>> --
>>>> PHP General Mailing List (http://www.php.net/)
>>>> To unsubscribe, visit: http://www.php.net/unsub.php
>>>>
>>>>
>>>
>>>
>>
>> --
>> PHP General Mailing List (http://www.php.net/)
>> To unsubscribe, visit: http://www.php.net/unsub.php
>>
>>
>>
>