$_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:
Did you know?Explore Trending and Topic pages for more stories like this.
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
Help With Showing Users On the Index Page
Ive got this code which works just how i want it to.
Code: <?
$timenow=time();
Multiple submit forms inside a mysql array page
Hi all,
Im having trouble to get the beneath script to work the thing i can't seem to get wor
INSERT data problem!
After having an string with apostrophes ', double quotes " or any other special characters, suc
Apart from cron
I need to run a php file every one hour. Is there any other solution apart from cron job?
Spaghetti Code
So.
I've pretty much reached the point where I have so many isset s on one page that I can't
Date Format
Hi there,
I have a date format like this right now:
Sat, 17 Oct 2009 17:04:00
I ne
Change snippet to use CURDATE
I am using time() in the snippet below, I would like to use CURDATE() and have the database setup fo
Production of mango in processing industry
Hi,
We have one scenario ,company is in process industry,they are manufacturing MANGO pul
User feedback after MySQL query has been executed
Hi all, I've just registered on PHPFreaks because I've got a question that I simply can't work out b
Not Loading Function Into Div
I'm not sure whether to put this under the php forum or ajax forum but because I tink it's more of a