Jump to content

$_GET Question


smithmr8

Recommended Posts

Hi,

Im trying to produce the following link, 'company.php?step=apply&id=1'. This I have managed to do, successfully.

 

The part I am having trouble with is this part..

<?php
if($_GET['step'] == 'apply' $ $_GET['id'] == $ID){}
?>

I have tried this approach, where $ID is defined before this is created and it works in regards to the URL forming correctly.. but when it comes to the above code, its not grabbing the number and passing the statement completely.

 

Do you know of a way In which I could get a statement like this working with a URL like, 'company.php?step=apply&id=1' ?

 

Thanks,

Luke

Link to comment
https://forums.phpfreaks.com/topic/92292-_get-question/
Share on other sites

I've changed that but it still isn't working.

 

$ID Defined

<?php
$ID = $app_info['applicant'];
	echo "<td width=\"70\">[<a href=\"company.php?step=accept&id=".$ID."\">Accept</a>][Deny]</td>";
?>

 

$ID Used

<?php
if($_GET['step'] == 'accept' && $_GET['id'] == $ID){
echo $ID;
}
?>

 

Any Ideas ?

Link to comment
https://forums.phpfreaks.com/topic/92292-_get-question/#findComment-472826
Share on other sites

<?php
include ('header.php');
$company_info = mysql_query("SELECT * FROM company WHERE ID=$x[company]");
$company = mysql_fetch_array($company_info);
if($_GET['step'] == 'admin'){
if($company['owner'] == $x['ID']){
echo "<b>Administration Options</b><br><br>";
echo "<a href=company.php?step=applications>Applications</a><br>";
} else {
echo "You are not the owner!<br>";
}
} elseif($_GET['step'] == 'applications'){
$application = mysql_query("SELECT * FROM application WHERE company=$company[iD] ORDER BY date DESC");
$approw = mysql_num_rows($application);
if($approw == 0){
echo "There are no applications";
} else {
echo "<b>Applications</b><br><br>";
echo "<table border=\"0\" width=\"100%\">";
echo "<tr>";
	echo "<td width=\"70\"><b>Date Sent</b></td>";
	echo "<td width=\"60\"><b>Applicant</b></td>";
	echo "<td width=\"150\"><b>Application</b></td>";
	echo "<td width=\"70\"><b>Options</b></td>";
echo "</tr>";
while ($app_info = mysql_fetch_array($application)){
$user = mysql_query("SELECT * FROM users WHERE ID=$app_info[applicant]");
$user_info = mysql_fetch_array($user);
echo "<tr>";
	echo "<td width=\"70\">".$app_info['date']."</td>";
	echo "<td width=\"60\">".$user_info['username']."</td>";
	echo "<td width=\"150\">".$app_info['message']."</td>";
	$ID = $app_info['applicant'];
	echo "<td width=\"70\">[<a href=\"company.php?step=accept&id=".$ID."\">Accept</a>][Deny]</td>";
echo "</tr>";
}
echo "</table>";
}
var_dump($_GET['step'], $_GET['id'], $ID);
} elseif($_GET['step'] == "accept" && $_GET['id'] == $ID){
echo $ID;
} else {
if($x['company'] == 0){
echo "Your not in a company!<br>";
} else {
echo "<font size=3><b>".$company['name']."</b></font><br>";
if($company['owner'] == $x['ID']){
echo "[<a href=company.php?step=admin><font color=FF0000>Administration</font></a>]<br><br>";
} else {
echo "<br>";
}
echo "<font size=1>Message:</font><br>";
if($company['message'] == ""){
echo "Company Message Has Not Yet Been Set!<br><br>";
} else {
echo $company['message']."<br><br>";
}
echo "<b>Options</b><br>";
echo "Quit Company<br>";
}
}
include('footer.php');

?>

 

I wouldn't call it huge :P. It just gets confusing if you stare at it too long.

Link to comment
https://forums.phpfreaks.com/topic/92292-_get-question/#findComment-472868
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.