943,852 Members | Top Members by Rank

Ad:
  • PHP Discussion Thread
  • Marked Solved
  • Views: 1307
  • PHP RSS
Sep 18th, 2008
0

Returning values from PHP file

Expand 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.
Similar Threads
Reputation Points: 10
Solved Threads: 2
Light Poster
mohammed2raja is offline Offline
30 posts
since Sep 2008
Sep 18th, 2008
0

Re: Returning values from PHP file

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..
Reputation Points: 137
Solved Threads: 162
Posting Virtuoso
Shanti C is offline Offline
1,641 posts
since Jul 2008
Sep 18th, 2008
0

Re: Returning values from PHP file

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 :
PHP Syntax (Toggle Plain Text)
  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
Reputation Points: 17
Solved Threads: 8
Junior Poster in Training
Banderson is offline Offline
66 posts
since Aug 2004
Sep 18th, 2008
0

Re: Returning values from PHP file

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.
Reputation Points: 21
Solved Threads: 11
Junior Poster
MVied is offline Offline
111 posts
since Aug 2008
Sep 19th, 2008
0

Re: Returning values from PHP file

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.
Reputation Points: 10
Solved Threads: 2
Light Poster
mohammed2raja is offline Offline
30 posts
since Sep 2008
Sep 19th, 2008
0

Re: Returning values from PHP file

Click to Expand / Collapse  Quote originally posted by MVied ...
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?
Reputation Points: 10
Solved Threads: 2
Light Poster
mohammed2raja is offline Offline
30 posts
since Sep 2008
Sep 19th, 2008
0

Re: Returning values from PHP file

you can pass more than one value by the following way,
window.location.href = "loginCheck.php?idValue=" + idValue+"&idvalue1="+idvalue1;
Reputation Points: 10
Solved Threads: 1
Newbie Poster
php2sheik is offline Offline
18 posts
since Sep 2008
Sep 19th, 2008
0

Re: Returning values from PHP file

Thank Shanti. Can u explain how can i use hidden variable in php.
see this example:
html Syntax (Toggle Plain Text)
  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 C; Sep 19th, 2008 at 8:18 am.
Reputation Points: 137
Solved Threads: 162
Posting Virtuoso
Shanti C is offline Offline
1,641 posts
since Jul 2008
Sep 19th, 2008
0

Re: Returning values from PHP file

see this example:
html Syntax (Toggle Plain Text)
  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.
Reputation Points: 10
Solved Threads: 2
Light Poster
mohammed2raja is offline Offline
30 posts
since Sep 2008

This thread is solved

Either the thread starter or a moderator has marked this thread as solved. You can most likely trust the responses and answers given. There is most likely no reason for any further responses to be posted here. If you have a related question, please start a new thread in this forum instead.

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in PHP Forum Timeline: passing more than one values to php file
Next Thread in PHP Forum Timeline: Help for Newbie! Need to create a link to larger image target _blank in PHP





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC