Hi
How to pass javascript variable in PHP?
Any help ?
<snip>
| SitePoint Sponsor |
Hi
How to pass javascript variable in PHP?
Any help ?
<snip>
Last edited by TechnoBear; Sep 15, 2012 at 04:30. Reason: Please wait 90 days for a real signature

Yes sure, give us an example of what you want to send.

One way is to:
HTML Code:<script type="text/javascript" charset="utf-8"> var myJsVar="<?php echo $myPhpVar; ?>"; </script>

Here's an onclick example:
That's javascript using a php variable - don't think it can be done the other way round.PHP Code:echo '<input id="server" onclick="window.location.href=\'filename.php?server='.$server.'\'" type="button" name="server" value="Server">';
Detect file changes remotely. SimpleSiteAudit is an early
warning anti-hacker system which sends an alert on detection.
PHP Find Orphan Files - Finds all the unreferenced files on your site.
I am understanding your problem but there is no way to pass the javascript variable to php page rather than ajax or window.location method.
Code:<script type="text/javascript"> function passvariable(var){ window.location.href= 'filename.php?var='+var; } </script> <input type="button" value="submit" onclick="passvariable('<?php echo $phpvariable;?>');"/>
Bookmarks