jofftan
-
Posts
4 -
Joined
-
Last visited
Never
Posts posted by jofftan
-
-
No I'm sorry I wasn't clear enough.
The links are in the dropdown of team members in the middle of the page. -
Here's the link
[url=http://www.virochempharma.com/corpo.php]http://www.virochempharma.com/corpo.php[/url]
When you get to this page I'm echoing the first entry of the DB.
If you select another entry from the dropdown it call a second page.
I want all that operation on a single page.
I don't know if it's possible ? -
Hi, I'm looking for a way to choose data content from a dropdown menu, linked to a MySQL DB, and echo it on that same page.
The problem is when you get to that page for the first time I need to display the first entry of the data by default.
Now I have it but with two php files, I want this on the same page.
The way it is right now is
Page 1 ;
[code]
<?php
$c = mysql_connect ($host,$usager,$Mpasse);
mysql_select_db ('db', $c);
if (!$c) {
die('Impossible de se connecter : ' . error_reporting(E_ALL));
}
$req = "SELECT * FROM Team";
$resultat = mysql_query($req);
echo '<ul id="subnavlist">';
while ($record = mysql_fetch_assoc($resultat)) {
echo '<li id="subactive"><a href="corpoTeam.php?id_team='.$record["id_team"].'" id="current">'.$record["Titre"].'</a></li>';
}
echo "</li>";
?>
[/code]
Page 2;
[code]
<?php
$_POST['id_team'];
include 'connexion.php';
$c = mysql_connect ($host,$usager,$Mpasse);
mysql_select_db ('db', $c);
if (!$c) {
die('Impossible de se connecter : ' . mysql_error());
}
$req = "SELECT * FROM Team";
$resultat = mysql_query($req);
echo '<ul id="subnavlist">';
while ($record = mysql_fetch_assoc($resultat)) {
echo '<li id="subactive"><a href="corpoTeam.php?id_team='.$record["id_team"].'" id="current">'.$record["Titre"].'</a></li>';
}
echo "</li>";
?>
</li>
</ul>
</div>
<div>
<?php
ini_set('display_errors', 1);
error_reporting(E_ALL);
$req = "SELECT * FROM Team WHERE id_team = ".$id_team;
// $resultat = mysql_query ("SELECT Titre, description, name FROM Team WHERE id_team = '".urldecode($_GET['id_team'])."'");
$resultat = mysql_query($req);
$row=mysql_fetch_array($resultat);
$name = $row['name'];
$Titre = $row['Titre'];
$description = nl2br($row['description']);
echo "<br>";
echo "<br>";
echo '<h4>';
echo $name;
echo '<br>';
echo $Titre;
echo '</h4>';
echo '<p>';
echo $description;
echo '</p>';
?>
[/code]
Thank you
Content on the same page of the query
in PHP Coding Help
Posted
Ok now it's calling the same page within the link so it work I don't know if it's secure but it work.
[code] while ($record = mysql_fetch_assoc($resultat)) {
echo '<li id="subactive"><a href="corpo.php?id_team='.$record["id_team"].'" id="current">'.$record["Titre"].'</a></li>';
}[/code]
But now I got this error to fix
[quote]Notice: Undefined variable: id_team in /var/www/vhosts/virochempharma.com/httpdocs/corpo.php on line 106
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /var/www/vhosts/virochempharma.com/httpdocs/corpo.php on line 109[/quote]