sseeley Posted June 11, 2010 Share Posted June 11, 2010 I have a number of text boxes which are given their IDs dynamically as the page loads. This enables me to have 5 text boxes which I can then post to a database. An example of the name would be $name = "name" . $incrementNo; Name would would then be Name 1, 2, 3, 4, 5 etc...I am trying to validate these with some javascript code and I am trying to use var name1 = document.getElementById("<?php echo $name; ?>").value; however the PHP page will not pass back the $name? Any idea how I can get this working? Thanks in advance. Stuart Quote Link to comment https://forums.phpfreaks.com/topic/204530-getting-php-variables/ Share on other sites More sharing options...
RichardRotterdam Posted June 13, 2010 Share Posted June 13, 2010 I have a number of text boxes which are given their IDs dynamically as the page loads. This enables me to have 5 text boxes which I can then post to a database. It would be easier to use your text boxes as array though. Take a look at the following post. http://www.phpfreaks.com/forums/index.php/topic,299599.0.html Name would would then be Name 1, 2, 3, 4, 5 etc...I am trying to validate these with some javascript code and I am trying to use var name1 = document.getElementById("<?php echo $name; ?>").value; however the PHP page will not pass back the $name? What does the complete php look like where you are trying to fetch the $name var? Quote Link to comment https://forums.phpfreaks.com/topic/204530-getting-php-variables/#findComment-1071383 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.