Solved

PHP Passing an array to another php file

Posted on 2014-09-16
27
171 Views
Last Modified: 2014-09-17
Experts,

I have an array variable of filenames and other stuff in one php file. I am trying to pass that variable to another php file but it's getting lost in translation. The line that generates the call is this, and it correctly opens my other  file when I click on the link.

"<a href=\"open.php?art=$art&row=$row\">";

Which generate this URL

http://lindamatthews.net/open.php?art=Array&row=0

Which seems correct.

Here is the code output

<?php echo "Hello World!"; ?>
<?php echo $art[$row][0]; ?>

Hello World prints correctly but the echo is missing for the array data.

How do I make the array visible in  my subroutine? Do I need something to read it from the request? Also do I need to define my subroutine as a function?

Thanks!
0
Comment
Question by:padmasambhava
  • 14
  • 8
  • 5
27 Comments
 
LVL 34

Assisted Solution

by:gr8gonzo
gr8gonzo earned 312 total points
ID: 40326102
First, the quick answer is to use serialization. The only data that can pass from script to script is a string. Basically, serialize() can turn an object or an array into an encoded string. Then, the receiving script can run unserialize() on the same encoded string to turn it back into an object or array again.

JSON encoding is another way of doing this (json_encode instead of serialize, and json_decode instead of unserialize), if you prefer a different format.

After encoding/serializing the data, you may need to further encode it with base64_encode, and then url_encode in order to safely pass the data. The receiving script would need to base64_decode first before the unserialize/json_decode.

Now, that said, it's USUALLY a bad idea to try and do this. Usually, this means that anyone else can pass data through, too, which makes a script vulnerable to attackers. It's usually better to pass only the ID and optionally some kind of checksum to discourage hackers from trying to mess with the data.
0
 
LVL 108

Expert Comment

by:Ray Paseur
ID: 40326177
Given the choice of serialized data and a JSON string, I would lean in the direction of JSON.  It's useful to other languages besides PHP and can be passed in the PHP session array.

You can see exactly what is present in the URL request with this:
var_dump($_GET);

Open in new window

0
 

Author Comment

by:padmasambhava
ID: 40326214
So in my calling file I have

  $art=serialize($art); $row=serialize($row);
  echo "<a href=\"open.php?art=$art&row=$row\">";

And in the called file I have

<?php $art=array(unserialize $art); ?>
<?php $row=integer(unserialize $row); ?>
<?php echo $art[$row][0]; ?>

This doesn't seem to work. Sorry I'm a total newbie with PHP.
0
 
LVL 108

Expert Comment

by:Ray Paseur
ID: 40326236
0
 
LVL 108

Assisted Solution

by:Ray Paseur
Ray Paseur earned 188 total points
ID: 40326246
When you echo something like this string:

"<a href=\"open.php?art=$art&row=$row\">";

And you see a URL containing the word "Array" like this:

http://lindamatthews.net/open.php?art=Array&row=0

It tells you that the variable $art was an array.  When PHP tries to echo an array, it simply puts the word Array into the output stream.  This does not trigger a warning, unfortunately.

If you want to show us your PHP code and your test data we may be able to help a bit further.
0
 

Author Comment

by:padmasambhava
ID: 40326266
The data is a 20x7 array that has filenames in column one.

The code is,

<?php include("header.php"); ?>
<?php include("menu.php"); ?>

<div class="content">
<p>
All images copyright Linda Matthews.<br>
<button onclick="history.go(-1);">Back </button>
</p>

<?php echo "Hello World!"; ?>
<?php $art=array(unserialize $art); ?>
<?php $row=integer(unserialize $row); ?>
<?php echo $art[$row][0]; ?>

<?php include("footer.php"); ?>
0
 
LVL 108

Assisted Solution

by:Ray Paseur
Ray Paseur earned 188 total points
ID: 40326315
The variable $art appears to be undefined in this statement:

<?php $art=array(unserialize $art); ?>

The statement is almost certainly incorrect, too.  But to start, let's try to find out where the $art variable gets assigned.

You probably want to add error_reporting(E_ALL) to the top of the PHP scripts.  It will help you get diagnostic messages about this sort of thing.
0
 

Author Comment

by:padmasambhava
ID: 40326384
What I sent you was all of the code, so how do I initialize it?
0
 

Author Comment

by:padmasambhava
ID: 40326398
Ah, it's blowing up in gallery.php so here is that paragraph.

$art = array
  (
  array("art/zen01.jpg","Zen+1", "Pen+and+Ink","5.75x7.5+Unframed+on+300lb.+Arches+Watercolor+Paper","$45", "Available","++++++++++","++++++++++","++++++++++","++++++++++"),
  array("art/zen02.jpg","Zen+2", "Pen+and+Ink","5.75x7.5+Unframed+on+300lb.+Arches+Watercolor+Paper","$40", "Available","++++++++++","++++++++++","++++++++++","++++++++++"),
  array("art/zen03.jpg","Zen+3", "Pen+and+Ink","5.75x7.5+Unframed+on+120lb.+Archival",               "$20", "Available","++++++++++","++++++++++","++++++++++","++++++++++"),
  array("art/zen04.jpg","Zen+4", "Pen+and+Ink","3.5x3.5+Unframed+on+120lb.+Archival",                "$12", "Available","++++++++++","++++++++++","++++++++++","++++++++++"),
  array("art/zen05.jpg","Zen+5", "Pen+and+Ink","2.75x3.875+Unframed+on+120lb.+Archival",             "$10", "Available","++++++++++","++++++++++","++++++++++","++++++++++"),
  array("art/zen06.jpg","Zen+6", "Pen+and+Ink","2.75x3.875+Unframed+on+120lb.+Archival",             "$10", "Available","++++++++++","++++++++++","++++++++++","++++++++++"),
  array("art/zen07.jpg","Zen+7", "Pen+and+Ink","5.75x3.75+Unframed+on+120lb.+Archival",              "$20", "Available","++++++++++","++++++++++","++++++++++","++++++++++"),
  array("art/zen08.jpg","Zen+8", "Pen+and+Ink","5.75x7.5+Unframed+on+120lb.+Archival",               "$40", "Available","++++++++++","++++++++++","++++++++++","++++++++++"),
  array("art/zen09.jpg","Zen+9", "Pen+and+Ink","7.5x5.75+Unframed+on+120lb.+Archival",               "$20", "Available","++++++++++","++++++++++","++++++++++","++++++++++"),
  array("art/zen10.jpg","Zen+10","Pen+and+Ink","5.75x7.5+Unframed+on+300lb.+Arches+Watercolor+Paper","$40", "Available","++++++++++","++++++++++","++++++++++","++++++++++"),
  array("art/zen11.jpg","Zen+11","Pen+and+Ink","5.75x7.5+Unframed+on+120lb.+Archival",               "$40", "Available","++++++++++","++++++++++","++++++++++","++++++++++"),
  array("art/zen12.jpg","Zen+12","Pen+and+Ink","5.75x7.5+Unframed+on+120lb.+Archival",               "$20", "Available","++++++++++","++++++++++","++++++++++","++++++++++"),
  array("art/zen13.jpg","Zen+13","Pen+and+Ink","5.75x7.5+Unframed+on+120lb.+Archival",               "$40", "Available","++++++++++","++++++++++","++++++++++","++++++++++"),
  array("art/zen14.jpg","Zen+14","Pen+and+Ink","7.5x11.5+Unframed+on+120lb.+Archival",               "$80", "Available","++++++++++","++++++++++","++++++++++","++++++++++"),
  array("art/zen15.jpg","Zen+15","Pen+and+Ink","7.5x11.5+Unframed+on+120lb.+Archival",               "$80", "Available","++++++++++","++++++++++","++++++++++","++++++++++"),
  array("art/zen16.jpg","Zen+16","Pen+and+Ink","7x8+Unframed+on+120lb.+Archival",                    "$50", "Available","++++++++++","++++++++++","++++++++++","++++++++++"),
  array("art/zen17.jpg","Zen+17","Pen+and+Ink","7x8+Unframed+on+120lb.+Archival",                    "$50", "Available","++++++++++","++++++++++","++++++++++","++++++++++"),
  array("art/zen18.jpg","Zen+18","Pen+and+Ink","7.5x11.5+Unframed+on+120lb.+Archival",               "$80", "Available","++++++++++","++++++++++","++++++++++","++++++++++"),
  array("art/zen19.jpg","Zen+19","Pen+and+Ink","11x15+Unframed+on+120lb.+Archival",                  "$150","Available","++++++++++","++++++++++","++++++++++","++++++++++"),
  array("art/zen20.jpg","Zen+20","Pen+and+Ink","11x15+Unframed+on+120lb.+Archival",                  "$150","Available","++++++++++","++++++++++","++++++++++","++++++++++")
);
echo "<table frame=\"hsides\" rules=\"rows\" border=\"1\" width=\"100%\">";
echo "<colgroup width=\"20%\"></colgroup>";
echo "<tbody><tr><td><a name=\"Zen\"></a>Zen Series</td>";
echo "<td align=\"right\"><a href=\"gallery.php\" style=\"text-decoration:none;color:red;\"> Top </td>";
echo "</tbody></table><br>";
for ($row = 0; $row < count($art); $row++) {
  $art=serialize($art); $row=serialize($row);
  echo "<a href=\"open.php?art=$art&row=$row\">";
  echo "<img src=",str_replace("art/","artT/",$art[$row][0]),"></a>";
  echo ' ';
}
?>
0
 
LVL 108

Expert Comment

by:Ray Paseur
ID: 40326404
In respect of your time, I'm going to recommend that you consider hiring a professional programmer to help you get going on this project.  Your choices are (1) take the time it requires to learn PHP programming (and you can do that if you have the time; this article tells how) or (2) get results quickly from a professional.

Maybe you can post the data (the 20x7 array)?  It's often easier to get a solution when we see the input data and have a clear vision of what you want for output.
0
 
LVL 108

Expert Comment

by:Ray Paseur
ID: 40326405
Thanks.  Let me look at that a bit more.  What do you mean when you say it's "blowing up?"
0
 
LVL 108

Assisted Solution

by:Ray Paseur
Ray Paseur earned 188 total points
ID: 40326433
Let's try to simplify this project and eat the elephant one bite at a time.  Have a look at this link with view source so you can follow the data from the $art array variable into the HTML document.
http://iconoun.com/demo/temp_padma.php

<?php // demo/temp_padma.php
error_reporting(E_ALL);

$art = array
  (
  array("art/zen01.jpg","Zen+1", "Pen+and+Ink","5.75x7.5+Unframed+on+300lb.+Arches+Watercolor+Paper","$45", "Available","++++++++++","++++++++++","++++++++++","++++++++++"),
  array("art/zen02.jpg","Zen+2", "Pen+and+Ink","5.75x7.5+Unframed+on+300lb.+Arches+Watercolor+Paper","$40", "Available","++++++++++","++++++++++","++++++++++","++++++++++"),
  array("art/zen03.jpg","Zen+3", "Pen+and+Ink","5.75x7.5+Unframed+on+120lb.+Archival",               "$20", "Available","++++++++++","++++++++++","++++++++++","++++++++++"),
  array("art/zen04.jpg","Zen+4", "Pen+and+Ink","3.5x3.5+Unframed+on+120lb.+Archival",                "$12", "Available","++++++++++","++++++++++","++++++++++","++++++++++"),
  array("art/zen05.jpg","Zen+5", "Pen+and+Ink","2.75x3.875+Unframed+on+120lb.+Archival",             "$10", "Available","++++++++++","++++++++++","++++++++++","++++++++++"),
  array("art/zen06.jpg","Zen+6", "Pen+and+Ink","2.75x3.875+Unframed+on+120lb.+Archival",             "$10", "Available","++++++++++","++++++++++","++++++++++","++++++++++"),
  array("art/zen07.jpg","Zen+7", "Pen+and+Ink","5.75x3.75+Unframed+on+120lb.+Archival",              "$20", "Available","++++++++++","++++++++++","++++++++++","++++++++++"),
  array("art/zen08.jpg","Zen+8", "Pen+and+Ink","5.75x7.5+Unframed+on+120lb.+Archival",               "$40", "Available","++++++++++","++++++++++","++++++++++","++++++++++"),
  array("art/zen09.jpg","Zen+9", "Pen+and+Ink","7.5x5.75+Unframed+on+120lb.+Archival",               "$20", "Available","++++++++++","++++++++++","++++++++++","++++++++++"),
  array("art/zen10.jpg","Zen+10","Pen+and+Ink","5.75x7.5+Unframed+on+300lb.+Arches+Watercolor+Paper","$40", "Available","++++++++++","++++++++++","++++++++++","++++++++++"),
  array("art/zen11.jpg","Zen+11","Pen+and+Ink","5.75x7.5+Unframed+on+120lb.+Archival",               "$40", "Available","++++++++++","++++++++++","++++++++++","++++++++++"),
  array("art/zen12.jpg","Zen+12","Pen+and+Ink","5.75x7.5+Unframed+on+120lb.+Archival",               "$20", "Available","++++++++++","++++++++++","++++++++++","++++++++++"),
  array("art/zen13.jpg","Zen+13","Pen+and+Ink","5.75x7.5+Unframed+on+120lb.+Archival",               "$40", "Available","++++++++++","++++++++++","++++++++++","++++++++++"),
  array("art/zen14.jpg","Zen+14","Pen+and+Ink","7.5x11.5+Unframed+on+120lb.+Archival",               "$80", "Available","++++++++++","++++++++++","++++++++++","++++++++++"),
  array("art/zen15.jpg","Zen+15","Pen+and+Ink","7.5x11.5+Unframed+on+120lb.+Archival",               "$80", "Available","++++++++++","++++++++++","++++++++++","++++++++++"),
  array("art/zen16.jpg","Zen+16","Pen+and+Ink","7x8+Unframed+on+120lb.+Archival",                    "$50", "Available","++++++++++","++++++++++","++++++++++","++++++++++"),
  array("art/zen17.jpg","Zen+17","Pen+and+Ink","7x8+Unframed+on+120lb.+Archival",                    "$50", "Available","++++++++++","++++++++++","++++++++++","++++++++++"),
  array("art/zen18.jpg","Zen+18","Pen+and+Ink","7.5x11.5+Unframed+on+120lb.+Archival",               "$80", "Available","++++++++++","++++++++++","++++++++++","++++++++++"),
  array("art/zen19.jpg","Zen+19","Pen+and+Ink","11x15+Unframed+on+120lb.+Archival",                  "$150","Available","++++++++++","++++++++++","++++++++++","++++++++++"),
  array("art/zen20.jpg","Zen+20","Pen+and+Ink","11x15+Unframed+on+120lb.+Archival",                  "$150","Available","++++++++++","++++++++++","++++++++++","++++++++++")
);

foreach ($art as $zen)
{
    echo PHP_EOL
    . '<br>'
    . '<a href="open.php?art="'
    . str_replace('art/', 'artT/', $zen[0])
    . '">'
    . $zen[1]
    . '</a>'
    . ' '
    . $zen[4]
    ;
}

Open in new window

0
 
LVL 34

Assisted Solution

by:gr8gonzo
gr8gonzo earned 312 total points
ID: 40326436
Don't forget to read the full instructions I posted. After serialize(), you also need to base64_encode() and url_encode() before passing:

$art=url_encode(base64_encode(serialize($art)));
$row=url_encode(base64_encode(serialize($row)));
echo "<a href=\"open.php?art=$art&row=$row\">";

On the receiving end, the url_decode is unnecessary. Just base64_decode and unserialize:

<?php $art=unserialize(base64_decode($art)); ?>
<?php $row=integer(unserialize(base64_decode($row))); ?>
<?php echo $art[$row][0]; ?>
0
How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

 

Author Comment

by:padmasambhava
ID: 40326919
Ok we may be getting closer!

It seems to fail at

  $art=url_encode(base64_encode(serialize($art)));

And the no more is written in the source.
0
 
LVL 34

Assisted Solution

by:gr8gonzo
gr8gonzo earned 312 total points
ID: 40328096
Oops. Should be urlencode, not url_encode. My mistake.
0
 

Author Comment

by:padmasambhava
ID: 40328400
Ok there's still a mistake in this paragraph

echo "<table frame=\"hsides\" rules=\"rows\" border=\"1\" width=\"100%\">";
echo "<colgroup width=\"20%\"></colgroup>";
echo "<tbody><tr><td><a name=\"Zen\"></a>Zen Series</td>";
echo "<td align=\"right\"><a href=gallery.php style=\"text-decoration:none;color:red;\"> Top </td>";
echo "</tbody></table><br>";
for ($row = 0; $row < count($art); $row++) {
  $art=urlencode(base64_encode(serialize($art)));
  $row=urlencode(base64_encode(serialize($row)));
  echo "<a href=open.php?art=$art&row=$row\"><img src=",$art[$row][0],"></a>";
  echo ' ';
}

The source file has the <table definition but nothing after it.
0
 

Author Comment

by:padmasambhava
ID: 40328467
Ok I got this one.
0
 

Author Comment

by:padmasambhava
ID: 40328661
Ok almost there!

<?php $art=unserialize(base64_decode($art)); ?>
<?php $row=(unserialize(base64_decode($row))); ?>
<?php echo $art[$row][0]; ?>

The html generated all works but that last echo doesn't make it in.
0
 

Author Comment

by:padmasambhava
ID: 40328679
If $row is an integer index, does it need to go through the encode/decode do-si-do?
0
 
LVL 34

Assisted Solution

by:gr8gonzo
gr8gonzo earned 312 total points
ID: 40328683
On the receiving side, if that's ALL the code you have, then you need to get the values from $_GET, like this:

<?php $art=unserialize(base64_decode($_GET["art"])); ?>
<?php $row=(unserialize(base64_decode($_GET["row"]))); ?>
<?php echo $art[$row][0]; ?>
0
 

Author Comment

by:padmasambhava
ID: 40328703
The URL gallery generates is

http://lindamatthews.net/open.php?art=YToyMDp7aTowO2E6MTA6e2k6MDtzOjEzOiJhcnQvemVuMDEuanBnIjtpOjE7czo1OiJaZW4rMSI7aToyO3M6MTE6IlBlbithbmQrSW5rIjtpOjM7czo1MToiNS43NXg3LjUrVW5mcmFtZWQrb24rMzAwbGIuK0FyY2hlcytXYXRlcmNvbG9yK1BhcGVyIjtpOjQ7czozOiIkNDUiO2k6NTtzOjk6IkF2YWlsYWJsZSI7aTo2O3M6MTA6IisrKysrKysrKysiO2k6NztzOjEwOiIrKysrKysrKysrIjtpOjg7czoxMDoiKysrKysrKysrKyI7aTo5O3M6MTA6IisrKysrKysrKysiO31pOjE7YToxMDp7aTowO3M6MTM6ImFydC96ZW4wMi5qcGciO2k6MTtzOjU6IlplbisyIjtpOjI7czoxMToiUGVuK2FuZCtJbmsiO2k6MztzOjUxOiI1Ljc1eDcuNStVbmZyYW1lZCtvbiszMDBsYi4rQXJjaGVzK1dhdGVyY29sb3IrUGFwZXIiO2k6NDtzOjM6IiQ0MCI7aTo1O3M6OToiQXZhaWxhYmxlIjtpOjY7czoxMDoiKysrKysrKysrKyI7aTo3O3M6MTA6IisrKysrKysrKysiO2k6ODtzOjEwOiIrKysrKysrKysrIjtpOjk7czoxMDoiKysrKysrKysrKyI7fWk6MjthOjEwOntpOjA7czoxMzoiYXJ0L3plbjAzLmpwZyI7aToxO3M6NToiWmVuKzMiO2k6MjtzOjExOiJQZW4rYW5kK0luayI7aTozO3M6MzY6IjUuNzV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TUrVW5mcmFtZWQrb24rMTIwbGIuK0FyY2hpdmFsIjtpOjQ7czo0OiIkMTUwIjtpOjU7czo5OiJBdmFpbGFibGUiO2k6NjtzOjEwOiIrKysrKysrKysrIjtpOjc7czoxMDoiKysrKysrKysrKyI7aTo4O3M6MTA6IisrKysrKysrKysiO2k6OTtzOjEwOiIrKysrKysrKysrIjt9fQ%3D%3D&row=13%22

Which I guess is ok, but open generates no html.
0
 

Author Comment

by:padmasambhava
ID: 40328738
I think the problem is the URL is 6600 bytes or so. Is this something I can write in the session?
0
 

Author Comment

by:padmasambhava
ID: 40328871
So in gallery

<?php
session_start();
$_SESSION['art']=$art;
?>

And in open I would have

<?php
$art= $_SESSION['art'];
?>

I'm going to try this.
0
 
LVL 34

Accepted Solution

by:
gr8gonzo earned 312 total points
ID: 40328898
Session variables are consistent throughout the site. So if you had two different links that had different values for $row or $art, then you would not be able to pass the intended one.

On a side note, I think I already mentioned that passing this much data through the link is a bad idea. The data you have looks ideally to be stored in a database.

That said, this should work, technically speaking. So let me know what the output is from the last response.
0
 

Author Comment

by:padmasambhava
ID: 40328951
Ok Gr8Gonzo and Ray! It works! Thank you both so much!
0
 

Author Closing Comment

by:padmasambhava
ID: 40328965
Well I now know much more about PHP so thanks for the lessons!
0
 
LVL 108

Expert Comment

by:Ray Paseur
ID: 40328996
the URL is 6600 bytes or so. Is this something I can write in the session?
That length probably exceeds what a browser can handle.  Be careful about storing serialized data in the session.  If you serialize a SimpleXML object and store it in the session, there is a risk that the entire session can be lost.
http://www.php.net/manual/en/function.unserialize.php#112823
0

Featured Post

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

Both Easy and Powerful How easy is PHP? http://lmgtfy.com?q=how+easy+is+php (http://lmgtfy.com?q=how+easy+is+php)  Very easy.  It has been described as "a programming language even my grandmother can use." How powerful is PHP?  http://en.wikiped…
Generating table dynamically is the most common issue faced by php developers.... So it seems there is a need of an article that explains the basic concept of generating tables dynamically. It just requires a basic knowledge of html and little maths…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
The viewer will learn how to dynamically set the form action using jQuery.

760 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now