They say a little knowledge is a dangerous thing and I only have a little php knowledge so please bear with me.
I have a page that displays records from a mySQL database. I have 3 buttons on the page and the first 2 are working fine.
Button 1 chose the record to display by id
Button 2 display the next record
Button 3 (not working I am getting unknown variable errors) to create a new record in another table from some of the data pulled by buttons 1 or 2.
I will post some of the code below
[php]
if (isset($_POST[‘get_records’]) || isset($_POST[‘next_rec’]))
{
$table = ($_POST[‘source’]);
$table = mysql_real_escape_string($table);
…
$rec_id = $row[‘id’];
$rec_first = $row[‘first’];
$rec_surname = $row[‘surname’];
$rec_sex = $row[‘sex’];
…
}
if (isset($_POST[‘new_rec’])){
echo"new record" . $surname; // This fails even though Surname is displayed by the get records call
}
[/php]
Surely I haven’t got to set all these variable as session variables to pass them to the second isset have I? Is there another / better way to do this?
TIA
Colin