Please help i need it badly :(

Codes here !

Moderators: egami, macek, gesf

Post Reply
New php-forum User
New php-forum User
Posts: 9
Joined: Wed Jun 20, 2012 6:26 am

Tue Jul 10, 2012 7:09 am

I'm newbie in Php.. I still have to learn many things.. but pls. help me in my big problem.. :(

The logic of my code is Suppose that the student is already logged in his account..
there's a page where it restricts a user to enter the page and he needs to register on that page..
without entering any details or it's just a button saying "Ask To Join"..
There's no syntax error.. but it directly goes to verified.php but the user needs to be verified..
to explain it simply, it's just like the YAHOO GROUPS.. where you need to join to access the group..

Please.. people with a good heart.. pls. help me... it will be very much appreciated.. Thank you very much..

Code: Select all

mysql_connect("localhost","root","") or die(mysql_error()); 
mysql_select_db("login") or die(mysql_error()); 


$username = $_COOKIE['ID_my_site']; 

	if (isset($_POST['submit'])) { 

			$check = "SELECT $username FROM students";
			$result = mysql_query($check) or die(mysql_error());
			while($row = mysql_fetch_array($result))
				 $id = $row['id'];
 				 $username = $row['username'];
				 $namelast = $row['namelast'];
 				 $namefirst = $row['namefirst'];
				 $namemi = $row['namemi'];
				$insert = "INSERT INTO pendings (id, username, namelast, namefirst, namemi)
				VALUES ($id, $username, $namelast, $namefirst, $namemi)";
				$add_member = mysql_query($insert) or die(mysql_error());	
				if (mysql_affected_rows()==1){
					$message .= "<h1>Registered</h1>
					<p>Thank you, Please wait for the approval of the faculty teacher who handles the subject.</p>";

<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post">

		<br />
		<input type="text" name="username" maxlength="60"value="$namelast"/>
		<input type="hidden" name="namelast" maxlength="20" value="$namefirst" />
	        <input type="hidden" name="namefirst" maxlength="20" value="$namemi" />
		<input type="hidden" name="namemi" maxlength="20" value="$username" />
               <input type="hidden" name="namemi" maxlength="20" value="$id" />

		<center><br /><br /><input type="submit" name="submit" value="Ask to Join"  style="width: 100px; height: 30px"/></center>

php-forum Super User
php-forum Super User
Posts: 1803
Joined: Thu Mar 10, 2011 5:07 pm

Tue Jul 10, 2012 8:37 pm

follow the simple logic, make sure you are doing what you want.

for example:

if (user is verified)
go to verified page
ask the user to register.

New php-forum User
New php-forum User
Posts: 9
Joined: Wed Jun 20, 2012 6:26 am

Thu Jul 12, 2012 9:02 am

Pls. help.....

is there a method that you can set two links in an <a href>..?

If the logged in is student..

the HOME Button will redirect to student page

If the logged in is faculty...

the HOME Button will redirect to student page..


Post Reply