passing vars from within a form with the onClick button even
Posted: Thu Sep 05, 2002 9:56 am
I'm pretty new to php and html programming.
I'm struggeling for days allready with the following question:
I have a phpscript that prepares a form. in that form there are select statements based on output from a database:
echo ' <tr>';
echo ' <td> CI ID </td>';
echo ' <td><select name = "ci_id">';
$query = "select id from ci";
$result= mysql_query($query);
$num_results = mysql_num_rows($result);
for ($i=0; $i < $num_results; $i++)
{
$row = mysql_fetch_array($result);
$ci_id=htmlspecialchars( stripslashes($row["id"]));
echo ' <option value ="'.$ci_id.'">'.$ci_id;
}
echo ' </select></td>';
echo ' </tr>';
the ci_id's found are just what they say: id's from a tableentry in a database.
There are more constructions like this in the form.
I now want to give the user a possibility to press an infobutton right behind the selection button. And when he presses it I want to represent to him the rest of the entry from the database so that he can see what belongs to the id he wants to chose.
I don't mind if it has to be via the onClick button and a php script , or via a URL to a php script or whatever. I just want to know how I can grab back the above $ci_id to be able to process that data.
I tried:
echo " <td><button onClick=\"window.open('test.php')\">Info </button></td>";
b4 the </tr>
it does call my script in a new window but:
<?php
echo 'Configuration_ID='.$HTTP_POST_VARS["ci_id"].'<BR>';
echo 'Configuration_ID='.$HTTP_GET_VARS["ci_id"].'<BR>';
?>
in that script only give empty , so it looks like it is impossible to process vars from within the form b4 the submit has been pressed.
Is there an elegant solution to do this ????
Thanx in advance
I'm struggeling for days allready with the following question:
I have a phpscript that prepares a form. in that form there are select statements based on output from a database:
echo ' <tr>';
echo ' <td> CI ID </td>';
echo ' <td><select name = "ci_id">';
$query = "select id from ci";
$result= mysql_query($query);
$num_results = mysql_num_rows($result);
for ($i=0; $i < $num_results; $i++)
{
$row = mysql_fetch_array($result);
$ci_id=htmlspecialchars( stripslashes($row["id"]));
echo ' <option value ="'.$ci_id.'">'.$ci_id;
}
echo ' </select></td>';
echo ' </tr>';
the ci_id's found are just what they say: id's from a tableentry in a database.
There are more constructions like this in the form.
I now want to give the user a possibility to press an infobutton right behind the selection button. And when he presses it I want to represent to him the rest of the entry from the database so that he can see what belongs to the id he wants to chose.
I don't mind if it has to be via the onClick button and a php script , or via a URL to a php script or whatever. I just want to know how I can grab back the above $ci_id to be able to process that data.
I tried:
echo " <td><button onClick=\"window.open('test.php')\">Info </button></td>";
b4 the </tr>
it does call my script in a new window but:
<?php
echo 'Configuration_ID='.$HTTP_POST_VARS["ci_id"].'<BR>';
echo 'Configuration_ID='.$HTTP_GET_VARS["ci_id"].'<BR>';
?>
in that script only give empty , so it looks like it is impossible to process vars from within the form b4 the submit has been pressed.
Is there an elegant solution to do this ????
Thanx in advance