[email protected] Posted March 25, 2010 Share Posted March 25, 2010 Hello, Here is my snippet, <script> function valid(name) { var t="<?php $_SESSION['FName']='<script>name</script>'; ?>"; } </script> <input name="chk" type="button" value="Submit" onclick="valid('Joe');" /> I need to store the variable 'name' in the php session variable 'FName'. Code is not exact or logical. But it could be similar. Struggling more. Need Help!!! Thanks. Link to comment https://forums.phpfreaks.com/topic/196481-assgining-values-to-a-php-variable-inside-javascript/ Share on other sites More sharing options...
trq Posted March 25, 2010 Share Posted March 25, 2010 Javascript executes on the client long after PHP has finished executing (on the server). Your form will need to submit its data back to the server as per usual. Link to comment https://forums.phpfreaks.com/topic/196481-assgining-values-to-a-php-variable-inside-javascript/#findComment-1031920 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.