By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,049 Members | 1,308 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,049 IT Pros & Developers. It's quick & easy.

how to display employer profile after they login?

100+
P: 127
i did the register form and login page for employer(company), but i have no idea how to display the employer profile(employer 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..
Jan 26 '07 #1
Share this Question
Share on Google+
2 Replies


Motoma
Expert 2.5K+
P: 3,235
i did the register form and login page for employer(company), but i have no idea how to display the employer profile(employer 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..
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.

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]
Jan 26 '07 #2

100+
P: 127
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.

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)login on my website, they can view and edit their company profile.
Note: company profile is the register information they had submitt when they register..Thanks..


REGISTER FORM

[PHP]<?php
include_once("database.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_register.php");
}


else


if($username==""){
$message="Please select a username!<br>";
include("emp_register.php");
}


else


if($password==""){
$message="Please select a password!<br>";
include("emp_register.php");
}


else


if($password2==""){
$message="Please re-type password!<br>";
include("emp_register.php");
}


else


if($password!=$password2){
$message="Password and re-type Password not same!<br>";
include("emp_register.php");
}


else


if($emailAdd==""){
$message="Opps.. You forgot enter your Email Address!<br>";
include("emp_register.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($myquery,$link_id) or die(mysql_error());

include_once("emp_registered.php");


}
}
}


?>[/PHP]

LOGIN FUNCTION

[PHP]<?php

extract ($_POST);

mysql_connect("localhost","root","")
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='$username'";

$result=mysql_query($sql)
or die("Cannot execute query");

$num=mysql_num_rows($result);


if($num==1) //username valid
{
$sql="select username from company where username='$username' and password='$password'";

$result2=mysql_query($sql)
or die("Cannot execute query");

$num2=mysql_num_rows($result2);
if($num2>0)
{
setcookie("Username", $username, time() + 60 * 60 * 24 * 365);
$today= date("D F d, h:ia");

include("welcome.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_login.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_login.php");
}



?>[/PHP]
Jan 26 '07 #3

Post your reply

Sign in to post your reply or Sign up for a free account.