Grabeorama Posted May 26, 2009 Share Posted May 26, 2009 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 More sharing options...
Ingolme Posted May 26, 2009 Share Posted May 26, 2009 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 More sharing options...
Grabeorama Posted May 26, 2009 Author Share Posted May 26, 2009 ok thanks, i'll try that a.s.a.p Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.