shubh2488 Posted December 1, 2011 Share Posted December 1, 2011 In this code i want to pass all the three red color code textbox value to a javascript function and print there. <?php $userid="123456789123456789"; $con = mysql_connect('localhost', 'root', ''); //Update hostname mysql_select_db("video_upload", $con); //Update database name //echo "--------".$viewall = $_GET['viewall']; //Display image $rs=mysql_query("select * from video "); while($row=mysql_fetch_array($rs)) { echo "<table width=\"600\">"; echo "<tr>"; echo "<td width=\"350\">"; echo $row['filename']; echo "</td>"; echo "<td width=\"100\">"; var art= echo "<input type=\"text\" value=\"Artist\" name=\"artist\" size=\"15\" id=\"artist\" onblur=\"if(this.value == '') { this.value = 'Artist'; }\" onfocus=\"if(this.value == 'Artist') { this.value = ''; }\" />"; echo "</td>"; echo "<td width=\"100\">"; var gen= echo "<input type=\"text\" size=\"15\" value=\"Genere\" name=\"genere\" id=\"genere\" size=\"15\" onblur=\"if(this.value == '') { this.value = 'Genere'; }\" onfocus=\"if(this.value == 'Genere') { this.value = ''; }\" />"; echo "</td>"; echo "<td width=\"50\">"; $var=$row['filename']; echo "<input type=\"hidden1\" value=\"$var\" id=\"filename\" name=\"filename\" />"; echo "<input type=\"submit\" value=\"save\" id=\"$var\" onclick=\"savedata1(id)\" />"; echo "</td>"; echo "</tr>"; echo "</table>"; echo "<br />"; } mysql_close($con); ?> function savedata1(id) { alert(id); [color=red]var artist[/color]=document.getElementById("artist").value; [color=red]var filename[/color]=document.getElementById("filename").value; //alert(filename); [color=red]var genere[/color]=document.getElementById("genere").value; </script> Link to comment https://forums.phpfreaks.com/topic/252199-passing-three-textbox-values-to-a-javascript-function/ Share on other sites More sharing options...
Adam Posted December 1, 2011 Share Posted December 1, 2011 Can you re-post the code formatted correctly? You can't use tags within tags, but you can within [quote] tags. Link to comment https://forums.phpfreaks.com/topic/252199-passing-three-textbox-values-to-a-javascript-function/#findComment-1293032 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.