Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
 
  HOME    TRACKER    PHP




Disable Passing Arrays In Query String?


Is there any way to stop PHP from turning a query string like this: ?var[] into an array when it is read by $_GET['var']? I have quite a few input validations that are easily screwed up by this strange (and apparently undocumented???) feature...




View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
Passing Value To A Query String
i have a value 35 to be passed to the query string in php i tried to first include the value manually in the action tag of form and then add $_REQUEST['pi']. pi is my query string value  its not working.

Simple Query String Not Passing
I've been messing with PHP for a few months now, and have some basics down. However, I thought I understood this issue, but here I am posting... <heavy sigh>.

Two files: register.php which is the form to allow a user to register with the site, and success.php which does the form validation, etc. If invalid input is found, I'm using the code below to go back to the register page.

@header("Location: http://url/register.php?id=1");

The id is examined in a switch statement on the register page to generate a message on the register form telling the user exactly what field the problem occurred in.

Here's the problem: The id value is not being passed in the redirect.

Can anyone tell me what I'm doing wrong?

Passing An Array Variable Through Query String ?
Is it possible for me to pass a variable which is an array like:

$highestREL[0] = "some value";
$highestREL[1] = "some value";
$highestREL[2] = "some value";
$highestREL[3] = "some value";
$highestREL[4] = "some value";
$highestREL[5] = "some value";

through a img tag like: PHP Code:

Passing Arrays
I have an eccomerce site that has a shared secure server this causes problems with my sessions because as soon as you go to the secure server it obviously starts a new session because it is on a different server. Firstly is there a way to stop this.

Secondly if not can I easily pass an array to the next page in a form, I don't think this is possible don't all items have to be displayed in the form, each item in the array needs a form field (hidden) in order to pas sit to the next page.

Passing Arrays To Functions
[code]
$job_status = array(
"unassigned",
"current",
"completed"
);

function gimme($name){
echo $$name; // this is in hopes to echo the contents of $job_status when gimme(job_status) is called
}

How can I get $name to be the ARRAY $job_status? I'm trying to keep this very modular so that I can also perform:

gimme(job_type); among others.

Passing Arrays To New Function
I am filling an array in one function and want to pass it to another. I am making the variable global with the correct syntax (I believe) PHP Code:

Passing 2D Arrays From PHP To Oracle
I have an existing Oracle database application that requires a
"simple" front-end (do these things ever turn out to be simple?).
There is an existing API written which I would like to reuse if
possible. Here is a snippet of the API:

TYPE property IS RECORD
( property_key VARCHAR2(8)
, property_value VARCHAR2(128) );...

Passing Arrays With A Form
Here is some code from the main page. PHP Code:

Passing Big Arrays To Another Page
I'm having a little problem on my advanced search system with large amounts of results, when trying to pass them to another page. Tried to use the serialize function but when the results reach a number, for instance, of 300 the link will not handle that. It works for small resultsets.

When user search the database for (example) stores in "New York" we get 256 results.
Now I want to give the user the chance to search on these results, the stores found in the former query that sell "bread", which would take the user to another page called "advanced search for store features".

This to avoid the use of big forms for these advanced searches, where I've created a degree set of search pages (I have about an overall 250 features to search).

The main problem seems to pass the array to the other page when large ammounts of data are set on this array, which I'll call here as $storeIDs. When the results are small, the serialize and unserialize function will do the job. Is there a way of going through this in other manner?

Passing Arrays Through Sesisions In 4.2?
I am trying to find out the easiest way to pass an array from page to page through sessions...using php 4.2. I was very familiar with the older versions, but now that I am moving to the new platform with the new variable prefixes ($_SESSION, $_POST, etc..) I feel sort of lost.

What I need to do is, for example, have a text field that when submitted, is sent to the same page, but is added to an array with the contents of the array being displayed. I need this to be able to be done as many times as needed. Here is a sort of sample of what I have been working on. Code:

Passing Arrays Between Servers
How can i pass a multi-dimensional array between 2 servers?

I tried serialize/unserialize but i have noticed it is working today and tomorrow not anymore. i played a little with it and even tried base64_encode(serialize($array)) only to find out that serialize does not always bring the expected results. Can it be that serialize is buggy (not realy my question)?

I do not want to use mysql as both servers are configured to deny remote access. ,I cannot use sessions because one server is a ssl server and the other is not, so this option is also out of question.

Passing Arrays In URLs
Passing Arrays in URLs. I.e passing arrays between two pages. This has been delt with here before but I can't help feeling there is a better way. The two current options are:
serialize and urlencode .... then ... urldecode and unserialize OR implode ... then ... explode But if you create a form with a multiple select in it like so:
<SELECT NAME=selectname[]> etc

.. the array $selectname appears automatically in the backend when the form is submitted. Note that $selectname is an array. This means that php must automatically create arrays from data POSTed in a particular format.

If we could pass an array in this format in a url or a hidden form then we wouldn't have to do anything on the recieving page. Anyone know what this format is?

Passing Arrays Between Two Pages
I'm trying to pass array values between two pages and on the second page I want to implode the array so I can use its values to interact with my db. This is what I'm doing right now: Code:

Passing Arrays To Functions
How do I pass an array to a function? This is what I have, and the second
function doesn't seem to be getting the array somehow. I'm sure it's in
the function declaration...

function one(){
return $array; // yes, there is more to this function, and assume that
"$array" is a real array
}

funtcion two($arrayArg){ // <- I'm sure the prob is here.
print_r($arrayArg); // This isn't printing anything, when it does in one()
}

then I call:
two(one());

Once again, I'm sure the prob is in the declaration.

Passing $_POST Arrays
I have a form which people fill in, it takes them to a page where the details are all displayed, and they then click on confirm to verify that these details are correct.

I thought the easiest thing to do would be to pass the whole post array through the form on the "confirm" page, then just extract it on the next (processing) page

However, when I try print_r on the value I assigned to the post array, it just says "Array". My code is below, what have I done wrong? Code:

Passing PHP Arrays To Mysql Best Solution
I am relatively new to PHP and until now I have only needed to use relatively simple php/mysql solutions.

I am working on a problem where I need to store CD information (Artist Name, Album Name, Track Names, Catalog Number)

I am working on a solution with two tables "album" and "tracks" and I am using the catalog number as a key to link the two.

The problem I am having is coming up with the best way to populate the tracks table as there are several tracks for each release. I am assuming that an array would be the correct way and maybe a dynamic form to input the tracks where you decide the number you need to add and this then creates a form with "n" input boxes?

Help Passing Arrays - Serialize Not Working...
I found this example somewhere:

<?php
if( isset($ser1) )
{
$arr1 = urldecode($ser1);
$arr1 = unserialize($arr1);
echo 'First four elements of array:'
echo $arr1[0] . '<br>' . $arr1[1] . '<br>' . $arr1[2] . '<br>' .
$arr1[3] . '<br>'
}
else
{
$arr[] = 'First'
$arr[] = 2;
$arr[] = 'Third'
$arr[] = 4;
$ser = serialize($arr);
$ser = urlencode($ser);
echo '<a href="' . $PHP_SELF . '?ser1=' . $ser . '">Pass</a>'
}
?>

It works fine. But my a href statement is something like this:

echo '<a
href="modules.php?op=modload&name=modname&file=index&req=dosomething&id1=1&
id2=1&text=$ser">Pass</a>'

I simply can not get this to work. It does not pass the serialized data
correctly. If I look in the status bar, it will show text= a:4:{i:0;s:

and then when I click the link it displays

a:4:{i:0;s:5:"First";i:1;i:2;i:2;s:5:"Third";i:3;i:4;}

How on earth do I do this?? Seems like it must be a syntax issue (i.e. my statement has all those &'s and the example does not).

Passing Arrays Through Posts, Gets, And Cookies
I used to use arrays in input data that will be turned into a
superglobal more often, but now that I care more about xHTML validity,
I don't. Validation checking websites (particularly the W3C validator)
yell at me for having square brackets in a name or id attribute. I
started going the simple way of just separating what would be the
array name from what would be the subscript with an underscore and
parsing that out with PHP later. Is there a better, valid way of doing
this that will have PHP set up my multidimensional superglobals for me
as it would with the square brackets?

Passing Checkbox Values Into The Correct Arrays
I've been looking at some code and the net for the past few hours trying to figure out what's wrong and I'm stumped. I have a form - multiple checkboxes (different names) and text fields going into an array. The text fields behave fine - the values from the first entry will populate elements of the first array.

The weird part is that the check boxes will pass the correct values but not always to the correct array element. For example, given two check boxes in a 2 element array, if you check the 1st box in the first element and the 2nd in the second element, on submission, the second element populates the first array element.

I've included a snippet of the code as an example - it's echoing things like crazy because I've been trying to see what's been going on. I hope someone can figure this out for me 'cause I'm completely stuck and am on a deadline. Code:

Passing Arrays From PHP To A Perl Script Run As Exec
Is there a way to get PHP to trigger a Perl script to run, AND pass that Perl script one or more arrays?

I need to run a Perl script at system level that returns a boolean 1 for fine and 0 for an error. Is this at all possible?

Help Needed Using Arrays In Query
I am try to use an array in a MySQL query using the in function. This requires a "," between each array entry but not at the end of the array. I can get a "," in between but I am left with one at the end. How can I get rid of the last ","?

MySQL Query And Arrays
I have a 'links' category on Table A and I want to retrieve the links from the Table and display them in a list-like fashion when the page is called upon. How would I go about seperating the links from one another (there a space inbetween each link.. EXAMPLE: http://asdf.com http://asdasd.com http://asdfff.com), loading them into an array (or using the best possible method to acces them easily) and then displaying them in a list like fashion..?

Query About Empty POST Arrays
I started programming in PHP recently and have a query about empty
$_POST arrays. I can see two scenarios when this could happen.

1. When some tries to directly load the page to which data is being
posted (for example, opening www.foo.com/xyz.php directly when a form
action is xyz.php)
2. When the user clicks the submit button without entering anything.

I am aware that Javascript validation can take care of the second case,
but it's unreliable. What is the accepted way of handling the above
situations on the server side?
Do I just reload the calling page if the array is empty?

Populating Arrays From MySQL Query
I have the following code: http://pastebin.com/746601

The field 'material' in 'is_material' contains multiple values for each
record in 'is_details'. Because of this I have used
'is_material_lookup' as a reference lookup table containing the
'style_code' and 'material_code' which refer to their full details in
the respective tables.

Currently I have got the script outputting all the details and one
material then in the next block of data, repeating the details with a
different material. What I would like to achieve is having 1 block of
data with a list of all materials in that, instead of the repeat, but
sadly I can't know exactly how to do it.

Arrays, Query Results And Select Box
I want/need to pre-select a drop-down box with a value if it's present in both a lookup table and user account table. After wrestling with this for a few hours I give up.

i know this can't be this complicated, but apparently i'm missing something, so if anyone can suggest a way to go about this i'd be a little more sane. The idea is to have the user value already selected then when they change the value i'll update their account.

Using Arrays With Mysql Query Results
im currently in the process of making a piece of code that will firstly take all the data from a table in mysql and then assign it to an array. This data will consist of several different rows of data each with different infomation for each field in the table.

i want to be able to use an array in a loop so that depending on which number of the loop is on will change the infomation that is assigned to a certain array. Code:

String Manipulation In Arrays
I'm reading in a text file into an array and I am trying to determine the first instance where a line is duplicated and tell me the index.

The problem is the first 10 characters of each line is a time stamp and I need to remove them before checking for duplicates.

I've not dealt with arrays much so i'm kinda lost. I can echo out each line without the time stamp using the substr string function but can't get that info back into the array or strip the first 10 characters before creating the array Code:

Passing A Query From A Form?
I have wrote a script to query my mysql database based up a name that
is selected from an HTML list menu, the form action calls to my php
script from my html doc, I have tested connectivity to the databse and
have added a manual sql query to my php script to be sure it is
functioning properly, the problem is I'm not sure how to get the
script to see what option the html form is sending, I thought I could
use:

$query = "SELECT * FROM table WHERE email =
'{$_GET['selecteduser']}@mydomain.com'";

but that doesn't seem to be working properly. Maybe the HTML document
is sending it correctly? Here is my form:

<form action="report_results.php" method="post">
<select name="selecteduser">
<option value="selecteduser">Select One:</option>
<option value="user1@mydomain.com">user1</option>
<option value="user2@mydomain.com">user2</option>
</select>
<input type="submit" name="submit" value="Go!">
</form>

This form calls to the php script which then takes the input from the
HTML form and processes it into the $_GET query and sends it to the
while loop in the script, I'm not sure why this is not working? Here
is my php code

PHP:
--------------------------------------------------------------------------------
<?php
$db = mysql_connect("localhost", "sqluser", "sqlpasswd") or
die("Could not connect to Mysql");
if (!$db == False)
{
mysql_select_db("mydb");
$query = "SELECT * FROM table WHERE email =
'{$_GET['selecteduser']}@mydomain.com'";

$result = mysql_query($sql,$db);
while ($row = mysql_fetch_row($result))
{
print "<tr>";
foreach ($row as $field)
{
print "<td>$field</td>";
}
print "</tr>";
}
mysql_close($cn);
}
else
{
print "Problem Connecting to the Database<br>";
}
?>
------------------------------------------------------------------------------

Passing Variable To SQL Query
I am trying to sort out an SQL statement. The below statement will return nothing when it's executed.

$date="2007-08-28 15:24:44";
$sql = 'select * from example order by abs( unix_timestamp(`$date`)- unix_timestamp(datetime) ) limit 1';

The problem is when I hardcode in vehicledate,(see below) it works just fine.

$sql = 'select * from example order by abs( unix_timestamp("2007-08-28 15:24:44")- unix_timestamp(datetime) ) limit 1';

I assume there is some problem passing variables into SQl statements. Does anyone know how to get this to work. In my PHP script I will be taking in the date from a website so hardcoding it in is not an option.

Passing Variables To A Mysql Query
I would like to find a way to accept user imput passed as a variable then submitted inside a MySQL query, only I want to use a dynamic variable in the initial query, I am still learning this and I am stumped on the best place to pass the variable information in a form without using sessions, I found several articles of interest however none of them went into the kind of detail a novice could interpret and act upon. PHP Code:

Passing A String That Has Quotes In It.
I have been struggling with a problem regarding passing some string/text data from one page to another and back and forth between forms. Some text is plain, no double quotes. example Other has phrases with double quote around it. "example"

I cannot figure out how to handle the double quotes as they keep the entire phrase(with quotes) from being passed when I try to pass them through a form. For example, this line will not pass the text with double quotes. Code:

<INPUT TYPE="text" class="inputbut" align="left" size=50 NAME="frm_item_name" VALUE="<? echo $item_name; ?>">

Passing A Value Not A String Between Pages
I have implemented a small calendar script into my site, as it is fairly essential to the content. To calculate the days it uses this array: PHP Code:

Passing A Variable From A Form To A MySql Query
I have a form set up with a dropdown list of values for a field "Genre" in my database

I can pass the variable to my php script. I know this because I use:

$Genre = $_POST['Genre'];

echo "<h1> Query result for Genre = ","$Genre", "</h1>";

And the page prints the appropriate value chosen from the form.

I'm trying to use the $Genre variable in a mysql query to select records which match.

My mysql query works when I use the following code:

Passing A Variable To Paginated Query Results
I have a form that passes a single variable via the GET function to a mysql databse query with the results paginated.  The first page of the results work fine, but the link to the second page yields the page 2 results of the entire table. I'm guessing that the variable hasn't passed to page2 query? Here's my code:

Passing Variables In A String To A Class
I have a class that handles establishing a connection to a mysql database, and outputting a mysql_query that can be acted upon to fetch results. I pass my sql query as a argument to the function in the class that handles the query. It's been working fine until I passed it a query that had a variable in it. PHP Code:

Passing String Problems To SQL Statement
I'm using php as my server side script. When I pass a certain string var that contains the char = ' An error occurs My SQL statement is;

Quote: $SQL = "SELECT n.tDate, c.CDNum, c.CWID, l.LessonTitle FROM CDInfo c, Lesson l, Num n WHERE l.LessonCode = c.CWID AND n.CDNum = c.CDNum AND l.LessonTitle = '$Title' ORDER BY n.tDate, n.UniqueNum ASC";

If my $Title = Vino's Dream World an error occurs bcos it only takes the val Vino and omits the remaining words.

Passing String Vars To User Defined Functions
I am reading data from csv into an arraz ... $data and $data[3] is a string.

Idefined several functions and everz one of them is called by myFooFunc($var1, $data[3])

problem is that $data[3] is emprty when passed to the funtion

i've echo'd it right before colling the function and the very entering the function and it looks like that...

Get Value Of Query String
I am trying to get the value of a query string. The query string variable name is stored in a array value(because I need to read one particular query string) PHP Code:

String Query
I'm trying to get this query in PHP: select answer,correct from quiz_answer WHERE (qsid=28 OR qsid=29 OR qsid=30) and correct='yes'

But the thing is that when I select a wrong answer then it displays qsid=66 OR, so this depends on how many questions wrong..PHP code:

Query String ?
i have a form that accepts user info. i have to add that info to my database and redirect the user to another site and fill the form on that site with the info the user just entered in my form. i am using the query string. the other website that i am transferring to is using jsp. Code:

Query String
How do you put the value of a form field into the query string. I have a
select field named title on a submission form. I'd like the selected value
to be put on the Form line

echo "<form name='form1' method='post'
action='admin/edit.php?selectfield=what goes here? '>";

function load()
{
require_once("../login.php");
login();

mysql_select_db("db");
$options = "select id from table order by id";
$optres = mysql_query($options);

$opt_results = mysql_num_rows($optres);
echo "<select name=title>";

for ($i=0; $i <$opt_results; $i++)
{
$optrow = mysql_fetch_array($optres);
$optionval = stripslashes($optrow["song"]);
echo "<option>$optionval</option>";
echo "<br>";
}
echo "</select>";
echo "</p>";

echo "<form name='form1' method='post'
action='admin/edit_tab.php?tab='>";

echo "<input type="submit" name="edittab" value="edit tab">";
echo "</form>";

Query String
How to pass the query string when the single table to be sorted. I just want to pass the query string for each column separately when clicked on the header.

When I click the column header it should sort in ascending when again clicked it should sort descending...

<a href="abc.php?name=asc ...........Name[/url]

Can You Ignore A GET Query String?
Hello all,

I have a recursive form that uses both GET and POST variables. After calling a GET, the string stays in the URI. When I do a POST, the scripts breaks because the GET string is still there.

I can't figure out how ignore or delete the query string after I'm done with it. unset() doesn't work.

Session In Query String
forgotten the little code snippet that adds a user session hash into the query string, how should i do this?

Making A Query String
I'm new to Google Groups (this is my first post or topic or
whatever it's called). I'm also new to PHP. My knowledge in PHP extends
to variables, basic fuctions, etc. I have a site with a MySQL 4.1.14
database and I use phpMyAdmin 2.6.3-pl1.

Suppose there's a page called videos.php. What do I need to do to get a
page called:
videos.php?name=matrix-ping-pong

Also, it would be helpful if you tell me how to add more pages (well,
it's really not a page, is it?) such as:
videos.php?name=hamster-dance

How To Build Query String?
From a form I have a list of fields, e.g:

name
address
phone
memo

I know how I do it manually for search query but how do I do it
automatically.

select * from <table_name> where
name = %$_POST['name']% and/or
address LIKE %$_POST['address']% and/or
phone LIKE %$_POST['phone']% and/or
memo LIKE %$_POST['memo']%

but my trouble if one of them is blank.

Getting Query String Value From A Variable
I have a url which is stored in a variable. I know which query string I want to extract from that url. How do I go about getting the value of the query string. PHP Code:

Php Query String Security
Hi was asking some questions about this in alt.php but some didn't get answered.
Yes I have read an awful lot now about php security and different advisories
and Idon't mind being called a competely dimwit but I still don't understand
what prevents this from happening if register_globals is ON:

http://www.mywebsite.com/anypage.php?firststep = fopen ("../etc/passwd", "r");&secondstep=fread($firststep,filesize("../etc/passwd"));

I can't seem to get this or any variations on the above to work inlcuding someting
like thirdstep = print $secondstep , but theoretically it should work shouldn't
it ?

Really my question is not about the above specifiically but it is about this:

Say you have a script which uses no variables, say it just echos 'hello' and
thats all it does, literally:

<?php
echo "hello";
?>

No variables, no include, or file or anything done by the user. Just echo hello
and exit. Nothing else. Is it possible in that scenario to run arbitray code
by doing something like I was describing about with etc/passwd ?



Using Variables In The Query String
I have a feeling im formatting this query string wrong and thats why it is not working.
Any ideas? Code:


Copyright © 2005-08 www.BigResource.com, All rights reserved