$_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 Like 34 Dislike
Previous forums Next forums
Other forums

DATEDIFF Question
First time post, and of course it is a help question.

I am using a WP plug-in to display prev

Need help in Generating Combinations
Need help generating all possible combination of names in an array

Lets say i have the follow

Why do I get this error
Parse error: syntax error, unexpected T_STRING, expecting ',' or ';' in /home/a5488351/public_html/b

Character Sets/Collations Stuff
Can someone please give me a check list of things I must do to setup all the charset stuff for my ph

Uploading/Downloading files stored in MySQL database
Hey all,

This problem just came up in my website and I'm having a hard time figuring out what

PHP, Arrays & A Lot Of Confusion
I've been doing basic PHP work on sites for a few years now, but I've never been tempted to learn ho

database design
Hi,

I got a page which allow candidate to type in their previous working experience,
I let

gettext translates ALWAYS?
I'm using gettext with the new version of XAMPP (5.3.0) on Windows Seven RTM (build 7600)
gettext

Material xxx does not exist in plant xxx
Dear All,

I am working for a steel project which is repetitive manufacturing.

Email/MMS to Site
Hey guys. I'm looking for a way for a user to upload images and/or text via their cell phones. It

Sign up to write
Sign up now if you have flare of writing..
Login   |   Register
Follow Us
Indyaspeak @ Facebook Indyaspeak @ Twitter Indyaspeak @ Pinterest RSS



Play Free Quiz and Win Cash