canadabeeau Posted December 15, 2009 Share Posted December 15, 2009 Is there a way to only let PHP run a piece of code if another variable has a value. Now I know about if but I need it to loop, so it continues to check Quote Link to comment Share on other sites More sharing options...
oni-kun Posted December 15, 2009 Share Posted December 15, 2009 Is there a way to only let PHP run a piece of code if another variable has a value. Now I know about if but I need it to loop, so it continues to check while ($variable) { //Do somehting } That's better. Use '!$variable' if you want to run something when it's empty Quote Link to comment Share on other sites More sharing options...
canadabeeau Posted December 15, 2009 Author Share Posted December 15, 2009 It is in relation to the fact that I have AJAX sending a JavaScript variable to process.php process.php then echos that JS variable as a PHP variable except its not, so I was wandering if it is becuase the JavaScript has not finished and got a result yet so I should make a loop untill it does and then echo Quote Link to comment Share on other sites More sharing options...
oni-kun Posted December 15, 2009 Share Posted December 15, 2009 It is in relation to the fact that I have AJAX sending a JavaScript variable to process.php process.php then echos that JS variable as a PHP variable except its not, so I was wandering if it is becuase the JavaScript has not finished and got a result yet so I should make a loop untill it does and then echo I read on your other thread you were requiring? That's not really what you're supposed to do, use the AJAX handler to get the response (i.e. ajax.response) and place it into what you wish the result to be: document.lblmacaddress.value=ajax.response; ,placing the result of your php file when it is DONE, into your code. See how easy ajax is? Quote Link to comment Share on other sites More sharing options...
canadabeeau Posted December 15, 2009 Author Share Posted December 15, 2009 oni-kun can you please help me with this AJAX, how and where do place your line of code? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.