Jump to content

Retrieving Data From Php


Grabeorama

Recommended Posts

Is there a way of retrieving a number or string from php with javascript, and then back to php?This is what I tried:I retrieved data from a database using php, and inserted it's value into a hidden form. With Javascript I retrieved the value using "document.getElementById('id').value", tried to add to that value using "onclick" with a link (didn't seem to work), then put the new value back into the hidden form.This didn't seem to work though, I hope I've explained it well...Any help is appreciated.

Link to comment
Share on other sites

You can send data from PHP to Javascript just by writing it in the code:

<script type="text/javascript">  var X = "<?php echo $x; ?>"</script>

To send data back to PHP, you would either have to use AJAX, or submit a form.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...