using javascript to put a php variable into an html textbox

  • techwiz
  • Beginner
  • Beginner
  • User avatar
  • Posts: 46

Post 3+ Months Ago

Hello,

I don't really understand whats happening here but:

Code: [ Select ]
<script type="text/javascript">
function FillForm(xml ) {
$("#xml").val(function(i, v) { return xml });
}
</script>
  1. <script type="text/javascript">
  2. function FillForm(xml ) {
  3. $("#xml").val(function(i, v) { return xml });
  4. }
  5. </script>


above is the function I found,I would like to use it with onClick, so that when a users clicks a graphical button, a certain php varible previously filled is entered into an html textbox.
below is the way i tried to implement the above function, but it doesn't seem to work.
Code: [ Select ]
echo "<td><a href=\"#\" onClick=\"javascript:FillForm('" . $slsxml . "');return false;\"><img src=\"img/tick.gif\" border=\"0\"></a></td>\n";


Any Ideas?
Thanks
TE
  • PolishHurricane
  • Mastermind
  • Mastermind
  • User avatar
  • Posts: 1585

Post 3+ Months Ago

I don't exactly know what you want to do, but hopefully you're not trying to modify a PHP variable on the client side while not using AJAX. This should help though:

http://api.jquery.com/val/#val2
  • techwiz
  • Beginner
  • Beginner
  • User avatar
  • Posts: 46

Post 3+ Months Ago

Sweet, that makes more sense.

I'm not trying to mod a php var on the client side. [tried that lastweek :)]

I found another work around because something in the rest of the code was causing an issue, because standalone this function works great.

Thanks
TE

Post Information

  • Total Posts in this topic: 3 posts
  • Users browsing this forum: No registered users and 83 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
cron
 

© 1998-2014. Ozzu® is a registered trademark of Unmelted, LLC.