Jump to content

Passing three textbox values to a javascript function


shubh2488

Recommended Posts

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>

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.