Returning values from PHP file

Thread Solved

Join Date: Sep 2008
Posts: 25
Reputation: mohammed2raja is an unknown quantity at this point 
Solved Threads: 1
mohammed2raja mohammed2raja is offline Offline
Light Poster

Returning values from PHP file

 
0
  #1
Sep 18th, 2008
Hi, I m new in this field. Actually I face a problem, I call a php file from a html file using javascript. I declare a variable in php file,I want to use this variable in the same html file after execution of php file.Please help.
Reply With Quote Quick reply to this message  
Join Date: Jul 2008
Posts: 1,076
Reputation: Shanti Chepuru is on a distinguished road 
Solved Threads: 98
Shanti Chepuru's Avatar
Shanti Chepuru Shanti Chepuru is offline Offline
Veteran Poster

Re: Returning values from PHP file

 
0
  #2
Sep 18th, 2008
i think you can't use a php variable in a html file...
If you want send some value from php file to html file, then put it in hidden variable at php file , and send it to html file..
Be intelligent, But Don't try to cheat.. Be innocent But Don't get cheated..
Reply With Quote Quick reply to this message  
Join Date: Aug 2004
Posts: 66
Reputation: Banderson is an unknown quantity at this point 
Solved Threads: 8
Banderson's Avatar
Banderson Banderson is offline Offline
Junior Poster in Training

Re: Returning values from PHP file

 
0
  #3
Sep 18th, 2008
Originally Posted by mohammed2raja View Post
Hi, I m new in this field. Actually I face a problem, I call a php file from a html file using javascript. I declare a variable in php file,I want to use this variable in the same html file after execution of php file.Please help.

Add .htaccess file to your directory

Inside the .htaccess file input :
  1. AddType application/x-httpd-php .html .htm
  2. AddHandler application/x-httpd-php .html .php .htm

This should allow you to use php in your .html files
Search Engine | Free Flash Games | Play Online Games | One Way Permanent Links | Online Games
If A equals success, then the formula is
_ A = _ X + _ Y + _ Z. _ X is work. _ Y is play._ Z is keep your mouth shut.
-- Albert Einstein
Reply With Quote Quick reply to this message  
Join Date: Aug 2008
Posts: 84
Reputation: MVied is an unknown quantity at this point 
Solved Threads: 5
MVied's Avatar
MVied MVied is offline Offline
Junior Poster in Training

Re: Returning values from PHP file

 
0
  #4
Sep 18th, 2008
If you're using JavaScript to call a PHP file, then it sounds like AJAX. In which case you would have to use the DOM to display the result of the PHP script. Please show us the script you're using.
"We've heard that a million monkeys at a million keyboards could produce the complete works of Shakespeare; now, thanks to the Internet, we know that is not true." - Robert Wilensky
Reply With Quote Quick reply to this message  
Join Date: Sep 2008
Posts: 25
Reputation: mohammed2raja is an unknown quantity at this point 
Solved Threads: 1
mohammed2raja mohammed2raja is offline Offline
Light Poster

Re: Returning values from PHP file

 
0
  #5
Sep 19th, 2008
Originally Posted by Shanti Chepuru View Post
i think you can't use a php variable in a html file...
If you want send some value from php file to html file, then put it in hidden variable at php file , and send it to html file..
Thank Shanti. Can u explain how can i use hidden variable in php.
Reply With Quote Quick reply to this message  
Join Date: Sep 2008
Posts: 25
Reputation: mohammed2raja is an unknown quantity at this point 
Solved Threads: 1
mohammed2raja mohammed2raja is offline Offline
Light Poster

Re: Returning values from PHP file

 
0
  #6
Sep 19th, 2008
Originally Posted by MVied View Post
If you're using JavaScript to call a PHP file, then it sounds like AJAX. In which case you would have to use the DOM to display the result of the PHP script. Please show us the script you're using.
Thanks.
window.location.href = "loginCheck.php?idValue=" + idValue;
I use this code to pass a single value, how can i pass more than one value?
Reply With Quote Quick reply to this message  
Join Date: Sep 2008
Posts: 18
Reputation: php2sheik is an unknown quantity at this point 
Solved Threads: 1
php2sheik php2sheik is offline Offline
Newbie Poster

Re: Returning values from PHP file

 
0
  #7
Sep 19th, 2008
you can pass more than one value by the following way,
window.location.href = "loginCheck.php?idValue=" + idValue+"&idvalue1="+idvalue1;
Reply With Quote Quick reply to this message  
Join Date: Jul 2008
Posts: 1,076
Reputation: Shanti Chepuru is on a distinguished road 
Solved Threads: 98
Shanti Chepuru's Avatar
Shanti Chepuru Shanti Chepuru is offline Offline
Veteran Poster

Re: Returning values from PHP file

 
0
  #8
Sep 19th, 2008
Originally Posted by mohammed2raja View Post
Thank Shanti. Can u explain how can i use hidden variable in php.
see this example:
  1. b>TicTacToe</b><br>
  2. Enter Move X.<br>
  3. <pre>
  4. <form action="tictactoe.php" method="GET">
  5. <input type="text" name="move" size=2>
  6. 0|x|2 <br>
  7. _|_|_ <br>
  8. 3|4|o <br>
  9. _|_|_ <br>
  10. 6|7|8 <br>
  11. </pre>
  12. <input type="hidden" name="board" value="0x234o678">
  13. </form>
Last edited by Shanti Chepuru; Sep 19th, 2008 at 7:18 am.
Be intelligent, But Don't try to cheat.. Be innocent But Don't get cheated..
Reply With Quote Quick reply to this message  
Join Date: Sep 2008
Posts: 25
Reputation: mohammed2raja is an unknown quantity at this point 
Solved Threads: 1
mohammed2raja mohammed2raja is offline Offline
Light Poster

Re: Returning values from PHP file

 
0
  #9
Sep 19th, 2008
Originally Posted by Shanti Chepuru View Post
see this example:
  1. b>TicTacToe</b><br>
  2. Enter Move X.<br>
  3. <pre>
  4. <form action="tictactoe.php" method="GET">
  5. <input type="text" name="move" size=2>
  6. 0|x|2 <br>
  7. _|_|_ <br>
  8. 3|4|o <br>
  9. _|_|_ <br>
  10. 6|7|8 <br>
  11. </pre>
  12. <input type="hidden" name="board" value="0x234o678">
  13. </form>
thank u. i get it.
Reply With Quote Quick reply to this message  
Reply

This thread has been marked solved.
Perhaps start a new thread instead?
Message:




Views: 1088 | Replies: 8
Thread Tools Search this Thread



Tag cloud for PHP
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2010 DaniWeb® LLC