To register for an Internet.com membership to receive newsletters and white papers, use the Register button ABOVE.
To participate in the message forums BELOW, click here
now before you assume that i'm a impatient/lazy newb, i'm a php newb, not a forum newb, i've used the search function, but the only match i found didn't explain it to a point where i could understand.
anyways, i'm in the middle of making my first custom php script and have hit a bit of a snag. i need a piece of data that's only ubtainable via js, but i need to know how use the variable produced in a php if/else statement:
Code:
var monitors = app.monitors.primary();
var res = monitors[0].rect;
<?php
if( $res[2] < 1024 && res[3] < 768)
.....
?>
blue=php
red=javascript
You realize that JS is client-side, and PHP is server-side, right? So anything you do in JS has to be transmitted back to the server before you can use it in a PHP script. This can be done through solutions such as AJAX, or simply reloading the page.
__________________
***If your problem has been solved, PLEASE click the RESOLVED LINK under "Thread Tools"***
"Well Bones, do the new medical facilities meet with your approval?" -- Kirk
"They do not. It's like working in a damn computer center" -- McCoy (Star Trek: TMP)
As I said, you'll need to look into methods that use Javascript to communicate with the server, such as AJAX. Otherwise, no. You're talking about two completely different ends of the connection here.
__________________
***If your problem has been solved, PLEASE click the RESOLVED LINK under "Thread Tools"***
"Well Bones, do the new medical facilities meet with your approval?" -- Kirk
"They do not. It's like working in a damn computer center" -- McCoy (Star Trek: TMP)
then does anyone know how i can make an if statement out of a javascript statement that will change the html, that's all i need, an if statement that will change the html of the page
Depending on what you need to do, sure, I've used JS to alter the HTML of pages.
But now you start running into browser compatibility issues. The JS I originally made seemed to be compatible with IE only - not a good practice to code for.
__________________
***If your problem has been solved, PLEASE click the RESOLVED LINK under "Thread Tools"***
"Well Bones, do the new medical facilities meet with your approval?" -- Kirk
"They do not. It's like working in a damn computer center" -- McCoy (Star Trek: TMP)
Not sure. You'll have to give it a shot and see what happens.
Sorry I can't be of much help... my knowledge of JS is very limited. If I get time in the next few minutes, I can play around with FF and JS and see what I can come up with. If you're free right now though, you'll probably get results sooner by tinkering with it yourself.
__________________
***If your problem has been solved, PLEASE click the RESOLVED LINK under "Thread Tools"***
"Well Bones, do the new medical facilities meet with your approval?" -- Kirk
"They do not. It's like working in a damn computer center" -- McCoy (Star Trek: TMP)
Location: Rapid Offensive Unit "Foreign Object Damage"
Posts: 19,122
Since this has ended up being about Javascript, I'm moving it to a different forum.
__________________
On two occasions I have been asked [by Members of Parliament], "Pray, Mr. Babbage, if you put into the machine wrong figures, will the right answers come out?" I am not able rightly to apprehend the kind of confusion of ideas that could provoke such a question.
I'm afraid that I'm going to have to give up on this one as well... sorry Samo. If you need help with the PHP side of it, feel free to re-post a PHP question!
__________________
***If your problem has been solved, PLEASE click the RESOLVED LINK under "Thread Tools"***
"Well Bones, do the new medical facilities meet with your approval?" -- Kirk
"They do not. It's like working in a damn computer center" -- McCoy (Star Trek: TMP)