473,396 Members | 2,036 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

passing variables to other pages

As you'll see, I'm a beginner php guy...

What i'm trying to achieve is:

1) List in AllProducts.php a set of products which are stored in a MySql
table. Each product has a picture. Each picture actually is a link to a
articulodetalle.php, where there will be greater pictures in, plus some
detailed text.
Code in AllProducts.php actually works fine:

$query = "SELECT * FROM articulos";
$result = mysql_query($query);
$i=0;
while($row = mysql_fetch_array($result, MYSQL_ASSOC))
{
if($i==$public_numero_de_items_por_fila){ //acá cambia de columna
$i=0;
echo "<TR><TH>";
} else {
echo "<TH>";
}
$i+=1;
//here I set up the link to detallearticulo.php *******
echo '<a href="detallearticulo.php?id_articulo=' . $row['id_articulo']
.. '">';
echo '<img width="150" border="0" src="images/' . $row['id_articulo']
.. '.jpg" >';
echo '</a>';
echo "<br>";
echo "id_articulo :{$row['id_articulo']} <br>";
echo "descripcion :{$row['descripcion']} <br>";
echo "precio : {$row['precio']} <br><br>";
}
***** an example of the the link created (in AllProducts.php )is:

detallearticulo.php?id_articulo=xyz325
The problem i'm having is that I've an empty variable value in
detallearticulo.php

$id_articulo (in detallearticulo.php)should have the variable value
associated with the product (xyz325), but it's empty...

What's happening?
Any advice would be apreciated...

sdos - jm
Jul 17 '05 #1
5 1592

"julian maisano" <ju**************@gmail.com> wrote in message
news:db**********@domitilla.aioe.org...
As you'll see, I'm a beginner php guy...

What i'm trying to achieve is:

1) List in AllProducts.php a set of products which are stored in a MySql
table. Each product has a picture. Each picture actually is a link to a
articulodetalle.php, where there will be greater pictures in, plus some
detailed text.
Code in AllProducts.php actually works fine:

$query = "SELECT * FROM articulos";
$result = mysql_query($query);
$i=0;
while($row = mysql_fetch_array($result, MYSQL_ASSOC))
{
if($i==$public_numero_de_items_por_fila){ //acá cambia de columna
$i=0;
echo "<TR><TH>"; } else {
echo "<TH>";
}
$i+=1;
//here I set up the link to detallearticulo.php *******
echo '<a href="detallearticulo.php?id_articulo=' . $row['id_articulo'] .
'">';
echo '<img width="150" border="0" src="images/' . $row['id_articulo'] .
'.jpg" >';
echo '</a>';
echo "<br>";
echo "id_articulo :{$row['id_articulo']} <br>";
echo "descripcion :{$row['descripcion']} <br>";
echo "precio : {$row['precio']} <br><br>";
}
***** an example of the the link created (in AllProducts.php )is:

detallearticulo.php?id_articulo=xyz325
The problem i'm having is that I've an empty variable value in
detallearticulo.php

$id_articulo (in detallearticulo.php)should have the variable value
associated with the product (xyz325), but it's empty...

What's happening?
Any advice would be apreciated...

sdos - jm


in detallearticulo.php do you have line like?

$id_articulo = $_GET['id_articulo'];

Shelly
Jul 17 '05 #2
Shelly wrote:
"julian maisano" <ju**************@gmail.com> wrote in message
news:db**********@domitilla.aioe.org...
As you'll see, I'm a beginner php guy...

What i'm trying to achieve is:

1) List in AllProducts.php a set of products which are stored in a MySql
table. Each product has a picture. Each picture actually is a link to a
articulodetalle.php, where there will be greater pictures in, plus some
detailed text.
Code in AllProducts.php actually works fine:

$query = "SELECT * FROM articulos";
$result = mysql_query($query);
$i=0;
while($row = mysql_fetch_array($result, MYSQL_ASSOC))
{
if($i==$public_numero_de_items_por_fila){ //acá cambia de columna
$i=0;
echo "<TR><TH>"; } else {
echo "<TH>";
}
$i+=1;
//here I set up the link to detallearticulo.php *******
echo '<a href="detallearticulo.php?id_articulo=' . $row['id_articulo'] .
'">';
echo '<img width="150" border="0" src="images/' . $row['id_articulo'] .
'.jpg" >';
echo '</a>';
echo "<br>";
echo "id_articulo :{$row['id_articulo']} <br>";
echo "descripcion :{$row['descripcion']} <br>";
echo "precio : {$row['precio']} <br><br>";
}
***** an example of the the link created (in AllProducts.php )is:

detallearticulo.php?id_articulo=xyz325
The problem i'm having is that I've an empty variable value in
detallearticulo.php

$id_articulo (in detallearticulo.php)should have the variable value
associated with the product (xyz325), but it's empty...

What's happening?
Any advice would be apreciated...

sdos - jm

in detallearticulo.php do you have line like?

$id_articulo = $_GET['id_articulo'];

Shelly


Absolutely not :(

I didn't know it was requeired. I'll look to php.net to see what the
hell is $_GET ...

By the way, I looked an example that didn't have $_GET and worked though

thanks - jm
Jul 17 '05 #3
julian maisano (ju**************@gmail.com) decided we needed to
hear...
As you'll see, I'm a beginner php guy...

What i'm trying to achieve is:

1) List in AllProducts.php a set of products which are stored in a MySql
table. Each product has a picture. Each picture actually is a link to a
articulodetalle.php, where there will be greater pictures in, plus some
detailed text.


Code in AllProducts.php actually works fine:

$query = "SELECT * FROM articulos";
$result = mysql_query($query);
$i=0;
while($row = mysql_fetch_array($result, MYSQL_ASSOC))
{
if($i==$public_numero_de_items_por_fila){ //acá cambia de columna
$i=0;
echo "<TR><TH>";
} else {
echo "<TH>";
}
$i+=1;
//here I set up the link to detallearticulo.php *******
echo '<a href="detallearticulo.php?id_articulo=' . $row['id_articulo']
. '">';
echo '<img width="150" border="0" src="images/' . $row['id_articulo']
. '.jpg" >';
echo '</a>';
echo "<br>";
echo "id_articulo :{$row['id_articulo']} <br>";
echo "descripcion :{$row['descripcion']} <br>";
echo "precio : {$row['precio']} <br><br>";
}


***** an example of the the link created (in AllProducts.php )is:

detallearticulo.php?id_articulo=xyz325


The problem i'm having is that I've an empty variable value in
detallearticulo.php

$id_articulo (in detallearticulo.php)should have the variable value
associated with the product (xyz325), but it's empty...

What's happening?
Any advice would be apreciated...

sdos - jm


You seem to be assuming that $id_articulo will be set for you
automatically. If register_globals is on in php.ini then that
is what will happen, however register_globals is a potential
security risk (when not used correctly) and so its default
value is off since PHP 4.2

The "correct" way to access the variable passed from your first
script is to use $_GET['id_articulo'] instead of $id_articulo

--
Dave <da**@REMOVEbundook.com>
(Remove REMOVE for email address)
Jul 17 '05 #4
"julian maisano" <ju**************@gmail.com> wrote in message
news:db**********@domitilla.aioe.org...
Shelly wrote:
in detallearticulo.php do you have line like?

$id_articulo = $_GET['id_articulo'];

Shelly


Absolutely not :(

I didn't know it was requeired. I'll look to php.net to see what the hell
is $_GET ...

By the way, I looked an example that didn't have $_GET and worked though

thanks - jm


When you pass values in the caller page by:

calledpage,php?thing1=value1&thing2=value2

you get them in the called page, calledpage.php, by:

$variable1 = $_GET['thing1'];
$variable2 = $_GET['thing2'];

Shelly
Jul 17 '05 #5
julian maisano wrote:
Absolutely not :(

I didn't know it was requeired. I'll look to php.net to see what the
hell is $_GET ...

By the way, I looked an example that didn't have $_GET and worked though


It does when register_globals is set to On in php.ini (which is a bad
idea). Another way is to first call:

extract($_GET, EXTR_SKIP);

and then do what you used to do. I wouldn't use that though and stick
with using $_GET['xx'], because you'll see immediately that the variable
in question is a GET variable and it's safer.

--
http://www.phpforums.nl
Jul 17 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: Matthew Robinson | last post by:
i read a tutorial the other day on passing variables between php pages using a html form and setting the action to the php page to parse, can anybody see anything wrong with the code below? the...
4
by: Doruk | last post by:
The problem that we are experiencing is simple: We want to pass certain parameters from a page with several server controls to another page. We want to do this in a dotnet compliant manner,...
1
by: Eric | last post by:
Hello, I am trying to come up with the best way to pass large amounts of data from page to page, namely a data table. The user needs to enter data into a form in one page and confirm it on...
2
by: Roy | last post by:
Hey all, Is it possible to pass session variables between pages in separate projects? For example: inetpub\thisproject\blah.aspx has a session variable and response.redirects the user to...
7
by: Khai | last post by:
First off, yes, I understand the crapload of tutorials out there, (well, rather, I understand there /are/ a crapload of tutorials out there), the problem is my comprehension. I'm trying to pass...
28
by: Skeets | last post by:
i'm passing session and hidden variables between pages. not to mention post values. i'm a little concerned that someone with sufficient knowledge could spoof these vlaues and manipulate the...
7
by: Smokey Grindle | last post by:
For a website that has users logged into it using sessions, its it best to pass data between pages in session variables or through query strings?
22
by: K. A. | last post by:
I have two servers at work, 'A' for testing and development, and server 'B' for production. On server A, I wrote a PHP test code to login users then direct them to a personalized page. This is...
6
by: coool | last post by:
Hi :) anyone knows how can I send variables from a php page to a form - i need to fill the form with these variables ? maybe using (the process of passing variables to other pages - through...
3
by: dbuchanan | last post by:
newbie question What are the various ways that data can be passed between pages. For example; How is data about the logged in user passed to subsequent pages Thank you, Doug
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.