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 Link to comment https://forums.phpfreaks.com/topic/185166-php-pause/ 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 Link to comment https://forums.phpfreaks.com/topic/185166-php-pause/#findComment-977456 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 Link to comment https://forums.phpfreaks.com/topic/185166-php-pause/#findComment-977459 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? Link to comment https://forums.phpfreaks.com/topic/185166-php-pause/#findComment-977463 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? Link to comment https://forums.phpfreaks.com/topic/185166-php-pause/#findComment-977466 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.