...

View Full Version : pass dynamic text from html in javascript to php?



unknown00
07-11-2011, 04:51 PM
not sure what section to post this in, basically i have html in a javascript function that i want to pass into a php.

here is some of my javascript code


var names = document.getElementById('names').value;
var nms = names.split(";;")
for (i=0; i<las.length; i++)
{
var contentString = [
'<div id="tab-1">',
'<p><h1>'+nms[i]+'</h1></p>',
'</div>'
+'<form action="index.php" method="post" enctype="multipart/form-data">'+
'<input id="delbutton" name="delbutton" type="submit" value="Delete">',+'</form>'
}
then when the button gets pressed it goes to

if(isset($_POST['delbutton'])=='Delete')
{
echo("into the php delete: " . $_POST['name2'] . "<br />\n");
echo '<pre>' . print_r($_POST,true) . '</pre>';
}

basically i want to be able to access the value of nms[i] in the php call. i am able to pass anything in <input> tags like normal html, but i want to get nms[i] to go through

what should i do?

abduraooft
07-11-2011, 04:57 PM
if(isset($_POST['delbutton'])=='Delete')
That should be just

if(isset($_POST['delbutton']))



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum