$_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
grouping within a foreach?
hello all,
I currently have a list of products spit out from my db via a foreach loop. Right
Seperate team from score
I am writing a site that does a NFL Pick 'em type application and I have a feed that gives me the sc
PHP Login
Hey!
I got this shopcart code online, am trying to modify it but am getting an error when i try a
Inter Company -- Resources Related Billing (Services Industry)
Hello,
My company has a scenario where:
Company A bills Company C for INTER (cross
Windows 7
Windows 7 default user account control worries experts. Corporate IT departments should be pleased w
Spliting paragraph into sentences and attach in
Here is what I am trying to do
example: Para1[123.456.789!] 3 sentences
Para2
query based on 2 conditions
I want to select if the doc_type is either s OR f but this doesn't work:
Code: [Select]$query
Login logout link help
Hi all,
Im new to php and Im having trouble creating a login/logout link for my page that dis
mysql_real_escape_string
Let me preface this that I am very much a PHP noob, but I have some SQL training (not necessarily My
Keeping track of php uploads
Hello all.
I was looking at the way PHP handles file uploads.
It seems that PHP uses a tem