$_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
Displaying data from database into a 2 dimensional table
Good day!
I'm a beginner in PHP and I'm not expecting a full coding for this qestion. I'm jus
using file_get_contents??
okay how would i create a script using file_get_contents() in php have it grab search pages 1-20 and
remove innitial and
tags
i am using tiny_mce as a text editor for my CMS.
buy now the problem is it add <p>
Comma seperated implode & modifying returned string.
I have a PHP post form that posts up to 4 variables. I need whatever variables are passed to be comb
Attempt to assign property of non-object in...
I'm having issues with the following function in PHP 5...
function getTreeWithChildre
Will this protect from mysql injection?
I do not want anything like DROP TABLE to work or any type of coding..
Heres my code.. is it
Only add new information from XML to MySQL
What I am doing, is taking a xml file, and adding the values to a database. However, what I want to
At max how many columns is advisable to create in a table/view
Hi All,
I have two transaction table from which i want to create a simple view or material
Sending a hyperlink through mail
HI all,
I am sending a mail to outlook mailbox of a user using FM SO_NEW_DOCUMENT_ATT_S
how to query data from website using VC?
I want to query some datum from a website,so I need a program to read data from a .csv file, and ass