i did the register form and login page for employer(compan y), but i have no idea how to display the employer profile(employe r information when they submit the register form which store in database)after the employer login. May i know the idea how to display company profile after they have login. Thanks..
how to display employer profile after they login?
Collapse
X
-
I'm assuming your form does either a POST or a GET operation to submit the form data. In your script, you can refer to the elements by the $_POST and $_GET variables.Originally posted by bb nicolei did the register form and login page for employer(compan y), but i have no idea how to display the employer profile(employe r information when they submit the register form which store in database)after the employer login. May i know the idea how to display company profile after they have login. Thanks..
If you have an HTML file that looks like:
[HTML]<form action="reg.php " method="POST">
<input type=text name=company />
<input type=submit name= submit value="Submit" />
</form>
[/HTML]
Then to reference the text field "company" your PHP code would look like:
[PHP]echo 'Thanks for submitting your company, '.$_POST['company'].'.';[/PHP] -
Originally posted by MotomaI'm assuming your form does either a POST or a GET operation to submit the form data. In your script, you can refer to the elements by the $_POST and $_GET variables.
If you have an HTML file that looks like:
[HTML]<form action="reg.php " method="POST">
<input type=text name=company />
<input type=submit name= submit value="Submit" />
</form>
[/HTML]
Then to reference the text field "company" your PHP code would look like:
[PHP]echo 'Thanks for submitting your company, '.$_POST['company'].'.';[/PHP]
Emm.. Thanks and sorry.. I don't really understand... I show my coding here, then maybe you will know more detail what i'm doing. Below is my php code forregister form and login function for company..The information that company register will save in (database)mysql . Now i need to do a function which is when the user(company)lo gin on my website, they can view and edit their company profile.
Note: company profile is the register information they had submitt when they register..Thank s..
REGISTER FORM
[PHP]<?php
include_once("d atabase.php");
class user {
function linkid ()
{
$db = new db();
$link_id = $db->dbconnect();
return $link_id;
} // end function linkid
function add_user($arr)
{
$link_id = $this->linkid();
$companyName = $arr['companyName'];
$companyType = $arr['companyType'];
$contactName = $arr['contactName'];
$description = $arr['description'];
$username = $arr['username'];
$password = $arr['password1'];
$password2 = $arr['password2'];
$emailAdd = $arr['emailAdd'];
$contactNum = $arr['contactNum'];
$fax = $arr['fax'];
$contactAdd = $arr['contactAdd'];
$city = $arr['city'];
$postcode = $arr['postcode'];
$state = $arr['state'];
$country = $arr['country'];
if($companyName ==""){
$message="Opps. . You forgot enter your Company Name!<br>";
include("emp_re gister.php");
}
else
if($username==" "){
$message="Pleas e select a username!<br>";
include("emp_re gister.php");
}
else
if($password==" "){
$message="Pleas e select a password!<br>";
include("emp_re gister.php");
}
else
if($password2== ""){
$message="Pleas e re-type password!<br>";
include("emp_re gister.php");
}
else
if($password!=$ password2){
$message="Passw ord and re-type Password not same!<br>";
include("emp_re gister.php");
}
else
if($emailAdd==" "){
$message="Opps. . You forgot enter your Email Address!<br>";
include("emp_re gister.php");
}
else
{
$myquery = "INSERT INTO company ( companyName, companyType, contactName, description, username, password, emailAdd, contactNum, fax, contactAdd, city, postcode, state, country )
VALUES ( '$companyName', '$companyType', '$contactName', '$description', '$username', '$password', '$emailAdd', '$contactNum', '$fax', '$contactAdd', '$city', '$postcode', '$state', '$country' )";
$result = mysql_query($my query,$link_id) or die(mysql_error ());
include_once("e mp_registered.p hp");
}
}
}
?>[/PHP]
LOGIN FUNCTION
[PHP]<?php
extract ($_POST);
mysql_connect(" localhost","roo t","")
or die("Cannot connect to the server");
mysql_select_db ("ums e-job portal")
or die("Cannot connect to the database");
$sql="select username from company where username='$user name'";
$result=mysql_q uery($sql)
or die("Cannot execute query");
$num=mysql_num_ rows($result);
if($num==1) //username valid
{
$sql="select username from company where username='$user name' and password='$pass word'";
$result2=mysql_ query($sql)
or die("Cannot execute query");
$num2=mysql_num _rows($result2) ;
if($num2>0)
{
setcookie("User name", $username, time() + 60 * 60 * 24 * 365);
$today= date("D F d, h:ia");
include("welcom e.php");
}
else //message send to emp_login.php when wrong password
{
$message="The username, $username exists, but you have not entered the correct password! Please try again.<br>";
include("emp_lo gin.php");
}
}
elseif($num==0) //message send to emp_login.php when username not valid
{
$message="The username you entered does not exist! Please try again.<br>";
include("emp_lo gin.php");
}
?>[/PHP]Comment
Comment