$_GET problem
Posted on
16th Feb 2014 07:03 pm by
admin
Hi all,
Have a bit of a problem with a little piece of code, I am not sure if this should be under php or ajax as I am not sure where the problem lies. Basically here is the script:
Code: [Select]while($row = mysql_fetch_assoc($query))
{
echo "<center><tr><td style='color:#00F' align='center'>";
echo "<a href='./pages/stockpage.php?id=";
echo $row["stock_id"];
echo "' title='Contact Us' onclick='Modalbox.show(this.href, {title: this.title, width: 600}); return false;'>";
echo $row['stock_name'];
echo "</a></td><td align='center'>";
echo $row['t_val'];
echo "</td><td align='center'>";
echo $row['quant'];
echo "</td><td align='center' style='color:#00F'>";
echo $row['TotValue'];
echo "</td><td>buttonhere</td></tr>";
$TotValue += $row['TotValue'];
}
All this does is display info from the database, the problem I have is with the link. If I put my mouse over the link before clicking I get the correct url, ie http://localhost/stockluck/pages/stockpage.php?id=0.
The link is meant to open in a modalbox ajax popup, this is the code for stockpage is as follows:
Code: [Select]<?php
include('../common/dbconnect.php');
$stock_id = $_GET['stock_id'];
$query="SELECT * FROM stocks WHERE stock_id='$stock_id'"
or die(mysql_error());
while($row = mysql_fetch_assoc($query))
{
echo $row['stock_name'];
}
?>
However, the value for $stock_id is coming back as undefined. Any ideas what is causing this?
Thanks
No comments posted yet
Your Answer:
Login to answer
200
34
Other forums
$variable = $variable
Hello
Sorry if this is a really simple question but I have run out of ideas. Is there a reall
Need help to modify php ELSE code
I'm trying to find a way to have the php code display a message if there is no inventory listed in t
Saving PHP output as a file
I wondered if anyone knows how to save the rendered output of a PHP script as a file?
I have
PHP using IF to display error
i have a MySQL query and i want to display 1 thing only if the number of affected rows is >=1
question about stripslashes and real_escape_string
im cleaning up an old app that I wrote fixing some of the vulernabilities from attacks.
I hav
Date Question
I'm using the TIMESTAMP() function within mysql to set the date/time for certain events. However, ho
how to get sn motherboard
Hello.
I want to get serial number motherboard, cpu and else hardware.
Can You show me sam
need Array help
This is what I have to do.
$teamname[1] = "Red Sox"
$teamname[2] = "Gian
socket makes browser hang...
I have a socket server, and I am having a problem at the moment...
A browser sends a http hea
PHP Session Issue
I'm having an issue with one section on my website dealing with sessions. Now I know that myself and