Hi people I have some code that was working and now isn't, any help appreciated.
This page should enable the user to select a table from a drop down (and have that selection remain visible in the drop down after the submit button has been clicked.) However the dropdown keeps showing the value in .$row[0], also the next dropdown should populate with the fields from the table selected in the first dropdown. The user thens selects the field he wants to add a new value to and enters that value in a txtbox and hits submit.
It seems that the variable $TableToEdit is not being posted.
Any help appreciated (Bound to be something really obvious that I just can't see it usually is ).
Thanks in advance.
Bobneed to name the file .phpThe file does have a .php extension, I had to change it before I could upload it. PHP is not a valid file extension for attachments here.
Bob1- your javascript is not at a good place, need to be in the head or in the body, not before the doctype
2-
<select style='width:100px' name="Field" size="1" >
<?php
$TblToEdit=$_POST['TblToEdit'];
$SFldquery= "SHOW columns from ".$TblToEdit." ";
$result = mysql_query($SFldquery, $connection) ;
while ($row = mysql_fetch_array($result))
{
if($row[0] ==$TblToEdit)
you compare field to table, never the same!!
should be
if ($row[0]==$_POST['Field'])
and you should add an if to see if the form as been post at least one time! cause your sql query won't work if $TblToEdit is emptyHey thanks for that. Sorry I took so long to reply; I've been away.
BobNZ
This page should enable the user to select a table from a drop down (and have that selection remain visible in the drop down after the submit button has been clicked.) However the dropdown keeps showing the value in .$row[0], also the next dropdown should populate with the fields from the table selected in the first dropdown. The user thens selects the field he wants to add a new value to and enters that value in a txtbox and hits submit.
It seems that the variable $TableToEdit is not being posted.
Any help appreciated (Bound to be something really obvious that I just can't see it usually is ).
Thanks in advance.
Bobneed to name the file .phpThe file does have a .php extension, I had to change it before I could upload it. PHP is not a valid file extension for attachments here.
Bob1- your javascript is not at a good place, need to be in the head or in the body, not before the doctype
2-
<select style='width:100px' name="Field" size="1" >
<?php
$TblToEdit=$_POST['TblToEdit'];
$SFldquery= "SHOW columns from ".$TblToEdit." ";
$result = mysql_query($SFldquery, $connection) ;
while ($row = mysql_fetch_array($result))
{
if($row[0] ==$TblToEdit)
you compare field to table, never the same!!
should be
if ($row[0]==$_POST['Field'])
and you should add an if to see if the form as been post at least one time! cause your sql query won't work if $TblToEdit is emptyHey thanks for that. Sorry I took so long to reply; I've been away.
BobNZ