Jump to content

javascript input button question


Applellial

Recommended Posts

Hi guys,

 

I'm trying to add a php string to some javascript:

 

document.getElementById("button").value = mygetrequest.responseText;

 

basically there are a load of buttons on one page. So i need to add a value at the end of button. Basically the ID of each row so button<? echo $row['ID']; ?> but i'm not too sure how i would do this in javascript.

 

Any help

 

 

Thanks in advance

Link to comment
https://forums.phpfreaks.com/topic/229634-javascript-input-button-question/
Share on other sites

It's not terribly clear what you're trying to do, exactly.  Do you need to get values from a php script and use them in the javascript, or are you just trying to use dynamic variables?  If you just need dynamically named buttons on the form, just create an i counter and tack that on to the end for each button and then have the php run through the $_POST array. 

 

If you're trying to have them named based on info returned from a php script, that's an entirely different animal.  That's what AJAX is all about.  You can't intermingle your php variables/values, but you can get data from a php script and parse it into the javascript--just use the same variable name and assign the value returned from the AJAX script. 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.