HI all,
I have a form with three fields it.
dlid (primary key, auto increment)
Surname
firstname
email
it routes to a switch that checks to see if the person completing the form has done so already, (sort of a login form if you will.) however if the person HAS NOT completed the form previously, it will add the data to a database. All of this works fine.
What I want to do next, is once the person has entered the details into the form, regardless of whether they have just been created or if they were already in the database, I want to redirect to an update form with their details in the fields.
I can't post the form back to itself because there are times I need to add the records.
Here is the code that I have so far:
I don't expect the user to update their info if they don't need to, but there will be download options relating to their profiles.
How do I get the users data into the update fields, based on the primary key from either a new record or from finding an old one?
-------------------------------------------------------------
"The most overlooked advantage of owning a computer is that if they foul up there's no law against whacking them around a bit."
I have a form with three fields it.
dlid (primary key, auto increment)
Surname
firstname
it routes to a switch that checks to see if the person completing the form has done so already, (sort of a login form if you will.) however if the person HAS NOT completed the form previously, it will add the data to a database. All of this works fine.
What I want to do next, is once the person has entered the details into the form, regardless of whether they have just been created or if they were already in the database, I want to redirect to an update form with their details in the fields.
I can't post the form back to itself because there are times I need to add the records.
Here is the code that I have so far:
Code:
//the int_login function
function int_login($surname,$firstname)
{
$connection = db_connect();
$query =mressf(" SELECT * FROM coll_downloads WHERE surname = '%s' AND firstname = '%s'",
($surname),($firstname));
$result = mysql_query($query);
//counts the number of rows in the query
$number_of_posts = mysql_num_rows($result);
if($number_of_posts == 0)
{
return false;
}
else
$row = mysql_fetch_array($result);
$_SESSION['int'] = $row;
return true;
}
//the switch
case "create":
if (int_login($params['int']['surname'],$params['int']['firstname']))
{
flash_notice('welcome back');
$post = $_SESSION['int'];
$route['view']='edit';
}
else
{
create_int($params['int']);
redirect_to('interest/edit');
}
break;
I don't expect the user to update their info if they don't need to, but there will be download options relating to their profiles.
How do I get the users data into the update fields, based on the primary key from either a new record or from finding an old one?
-------------------------------------------------------------
"The most overlooked advantage of owning a computer is that if they foul up there's no law against whacking them around a bit."