$_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
insert PHP code into function
Hi,
I'm having problems when trying following:
I have:
Code: [Select]createBar("Do
help finding hacking loopholes
i was attacked by a redirect php injection
my pc is clean of viruses
so i figure that
i have no idea why this isn't working
Code: <?php
session_start();
include("connect.php");
error_reporting(E
Using insert variable
need a way to inert variable data to mysql database
$acc = "212121212";
$nok =
check if string contain only a-z/A-Z
Is where any way to check if string contains only a-z/A-Z, without writing an array with all possibl
preg_replace question
Hello!!
I hope someone can help me with preg_replace.
I load two tables from an extern
preg-match with a string and numbers
Hi, I can't get the expression to work for my preg_match, what I'd like is for it to match the strin
passing an array of objects after submit
How do I do this? This is what I have tried and it is not working.
<form method="
PHP header help!
Hi all I am trying to get this php page to refresh every 5 seconds on my phone which is an aastra 48
Problem with shopcart code
Hello, I am having a bit of trouble being able to add a product to my shopcart. My mysql database i