5
Contributors
7
Replies
36
Views
4 Years
Discussion Span
Last Post by harbi.dayah
0

This is what I have Sofar :
I created From and save to mysql table let say <person>.. so I wanted to continue to next step of registeration but save diffrent table<academicq> so I want to get to Id from the <person> table and save mysql as foriegn key... this is whay I have so far...

//my php code for <person>
<?php 

include("connection/sqlconnect.php");

// get values from form
$staffId=$_POST['staffid'];
$fName=$_POST['fName'];
$lName=$_POST['lName'];
$country=$_POST['countryoforigin'];
$nationality=$_POST['nationality'];
$race=$_POST['race'];
$religion=$_POST['religion'];
$general_status=$_POST['general_status'];
$phone=$_POST['phone'];
$department=$_POST['department'];
$cposition=$_POST['position'];
$email=$_POST['email'];
$category=$_POST['category'];
$year=$_POST['year'];

// Insert data into mysql

echo "hithere ";


$sql= "INSERT INTO expertdirectory (staffId, firstName, lastName, countryoforigin, nationality, race, religion, general_status,
                                    department, cposition, year_employed, handphone, email) VALUES 
                                    ('$staffId','$fName', '$lName', '$country', '$nationality', '$race', '$religion',
                                    '$general_status', '$department', '$cposition', '$year', '$phone', '$email')";




$result=mysql_query($sql);
if($result)
{
echo "<BR>";

hearder("location: register/academic.php?staffId=$_POST[staffId]");
echo "the data sent somewhere";
}


mysql_close();
?>

And I get this error:
Fatal error: Call to undefined function hearder() in C:\xampp\htdocs\projectX\registration1.php on line 42
pls halp me thanks

1

Can I give you some additional advice? You said you are trying to save <person> table to <academic> table as foreign key right?

So why don't you try to normalize the database since the connector is staffId why dont you use left join functions? It will make it short and faster in computation of the database.

1
header("location: register/academic.php?staffId=$_POST[staffId]");
    echo "the data sent somewhere";
}

COuld be an issue. It may be best to save the staff_id in a session as opposed to making it visible and liable to messing with. ANyway, would the user know his/her staff_id to place it in a form? Or is this placed there from a previous form? Bit confused.

0

there can be no output to the browser be for the header().
So remove echo statments at line 24 and 38
also move the comment at line 1 inside the <?php tag

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.