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 "[color=red]<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 = ''; }\"  />[/color]";

                 echo "</td>";
                 echo "<td width=\"100\">";
                  var gen=  echo "[color=red]<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 = ''; }\" />[/color]";
                 echo "</td>";
                 echo "<td width=\"50\">";
                $var=$row['filename'];
                 echo "[color=red]<input type=\"hidden1\" value=\"$var\" id=\"filename\" name=\"filename\" />[/color]";
         echo "<input type=\"submit\" value=\"save\" id=\"$var\"[color=blue][color=red] onclick=\"savedata1(id)\"[/color][/color] />";
                 echo "</td>";

                         echo "</tr>";
                                 echo "</table>";

         echo "<br />";


        }
mysql_close($con);
?>




function savedata1(id)
{
alert(id);
var artist=document.getElementById("artist").value;
var filename=document.getElementById("filename").value;
//alert(filename);
var genere=document.getElementById("genere").value;
</script>

Opps sorry.

I'm really confused what you are really trying to do. You question doesn't even make any sense.

In this code i want to pass all the three red color code textbox value to a javascript function and print there.

How do plan on saving to the database you need to submit it thru a get/post, your js displays a msg box and saves it js vars how is it going to be submitted?

wheres the form tag. Your not checking for submitted data. What are the columns in your database. Is that all there is in your code?

Is this function even relevant, your trying to submit data to be able to submit data to mysql. I really don't understand what this if for unless your planning to use ajax.

function savedata1(id)
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.