how to pass data

This is where you share YOUR scripts with others

Moderators: macek, egami, gesf

sindu
New php-forum User
New php-forum User
Posts: 2
Joined: Fri Feb 23, 2007 10:58 pm

how to pass data

Postby sindu » Sat Feb 24, 2007 12:09 am

Code: Select all

<?php
$con = mysql_connect("localhost","root","mysql");
if (!$con)
  {
  die('Could not connect: ' . mysql_error());
  }
 
  mysql_select_db("mediway", $con);
   $id=$_POST["testid"];
    $name=$_POST["testname"];
   $desc=$_POST["description"];
   $price=$_POST["price"];
   
   
$mydata="INSERT INTO tests (TestId, TestName, Description, Price) VALUES ('$id','$name','$desc','$price')";
 $result=mysql_query($mydata)
 or die(mysql_error());
 
$query2="Select TestName from tests";
$results=mysql_query($query2)
     or die(mysql_error());
echo "<table border='1'>\n";
while ($rows=mysql_fetch_assoc($results)) {
echo "<tr>\n";
     foreach($rows as $value) {
     echo "<td>\n";
     echo "<a href='$result'>$value</a>";
     echo "</td>\n";
     }
}
 
 
 mysql_close($con);
?>


In the above script what i am doing is that i am inserting data to databas and retrieving only the test name from the databasa again
All the test names retrieved from the database are displayed as links
What i want is that when i click on each link it sholud retrieve the corresponding TestId and pass that TestId value to the ACTION page

CAn some one tell me how to do
It would be great help if u can give me the exact php code
Its really urgent as i need it to for web based project which i am doing
This function is relly important to me as i am using this function many number of times in my project
PLeeeeeeeeeeeeeease help

:help: :help:

Return to “Your Scripts”

Who is online

Users browsing this forum: No registered users and 1 guest

cron