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


SuperbHosting.net have generously sponsored dedicated servers to ensure a reliable and scalable dedicated hosting solution for BigResource.com.





[HELP PLEASE] Passing Variable To New Page


I am having hard time passing the variable to the next page. May be you can help me. Let me explain:

I am using mySQL database to store information about images (ID, name, author, description, etc). I am pulling some of the information to create this (look at the example here: http://www.gibsonusa.com/test/page/index.php) Now, I want a new window appear when user clicks on the image. I have achieved it with the following script:

echo "<script language="JavaScript">";
echo" function pop1() {";
echo" window.open("info.php?prod_id=$result[0]"); }"; $result[0] is variable that stores id of the image in database
echo "</script>";

I am calling this function in the following manner: echo"<img onclick="pop1();"";

You can see the result if you click on the image. The new page opens up, BUT the id (product_id in this case) value is not passed to the next page correctly. If you click on the first or second image on the first page it shows that the ID is the same for both of them. However if you look at the source code you can see that the ids are assigned correctly. The same thing happens if you click on any image that says “no image available” (I am using different script to generate those). It seems that the script picks up and stores in the memory the value of an ID of the last image generated with the script (I don’t know if that make sense).

Oh, by the way the contents of info.php that I am calling in the script above are as following:

<?
$myid = $_GET['prod_id'];
echo" Product ID: $myid<br>";
?>

What am I doing wrong? Can you help?
Thank you.




View Complete Forum Thread with Replies

Related Forum Messages:
Passing A Variable To A Page
Is it possible to pass a varialble to a page using just PHP/HTML. The object is to create a agenda page, with information comming from MySql, based on the choise of month in the index page in a different frame, i.e. the month is selected in frame 1.

Now i want to sent the choice of the user to a page, to be shown in frame 2, that is created with PHP, and use the variable in the MySql query.I know this can be done using java, but i would like to avoid that.

View Replies !
Passing More Than One Variable To The Next Page?
I've got a page with product info on it. The same page also has a recordset of variables.
I've got a button which has been written using php something like:

<? print"<a href="write_review.php?PID=$product_id">img etc...?>

and I've got $product_id = $_GET['PID']; at the top of the page! This passes the product ID to the next page so that I can use it! How would I pass another variable too using the same button? I've tried just adding &title=$product_title, but it doesn't seem to work?
I've already got $product_title = $_GET['title']; at the top of the page under the first one.

View Replies !
Passing A Variable Into A Another Page
I have a list that comes in during a while statement:

Jane
john
pete
..ect

and i have a hyperlink so i can view their stats... and i want to past their name
so i can get it in the next page...but the variable is not comming up:

<a href=info.php?name=$name>".$name."[/url]

this is what I get: http://localhost/mdo_main/info.php?name=

View Replies !
Passing Through A Variable From Url To Page
I have a php landing page and I'm trying to use a tracking code that would let me dynamically pass through part of the url of this page (like the number 6264) to a point on the page, such as in part of a hyperlink that's posted on the page.

Does anyone know if this is possible?

Ideally, I want to be able to access this page using a query string/tracking code that would include a 4-5 character variable that could be anything really, and it would make whatever that variable is, show up at any point on the page through the use of a token. I want to pass this variable through in an affiliate link.

This has gotta be a simple piece of code that does this. Does anyone know off-hand how someone would do this?

View Replies !
Passing A Variable To Another Page?
I'm writing a script for advertisers to signup to get a text link on my website. I'm using a verification page, to make sure they've entered in their information correctly.

I need the data to go from signup.php --> verify.php --> complete.php. I'm able to get the data from signup.php --> verify.php with <form method="post" action="verify.php">, but how can I pass normal variables from verify.php --> complete.php?

View Replies !
Passing Variable Between Functions On The Same Page
I have a function (below). The part I am confused abbout is the variable $cnt (in bold). I wish to use this variable in another function that is on the same PHP page, how can I pass the $cnt variable onto another function in the same page? I keep gettin the undefind variable message! Code....

View Replies !
Passing A Php Variable When Opening New Page
I am working on a file directory listing and file editor.  I have a index.php file which lists directory contents and a "create new file" link which pops up a new window to create a file within the working directory.  I am popping up that new window with javascript and I'm not sure how to pass the variable containing the working directory as I do that. Code:

View Replies !
Question On Passing A "variable" Back To A Calling Page
I have a php page that calls another php page to load a image from a
database (mysql) in to the calling page.

It works like this:
first_view.php has
<img src="image.php?img=5" width="200" border="1" alt="Image of
Sunset">

the image.php opens the database and returns the image to the page
(first_view.php).

image.php can (does) also pull the title of the image being loaded to
first_view.php out of the query where the image data is send back: Code:

View Replies !
Problem With Session Variable And Passing Variable On Insert
I am trying to set a session variable along with my insert statement but on the next page when I do my query I get no results even though I know there are. Code:

View Replies !
Passing Multiple Variable Errors...last Variable Vanishes.
I have been trying to figure this one out for a few days now and it is starting to drive me mad.  I'm sure this is something simple that I have done wrong but I can't for the life of me figure out what is wrong here. Some background.

I decided I needed to learn PHP, I really enjoy it but keep getting stuck on things like this due to my lack of knowledge.  So I set myself a challenge to write a PHP CMS system using PHP, mySQL, XHTML and CSS.  All was going fine (all be it rather slowly) until I tried to write the page to edit articles in the CMS.

I have the 'ID', 'title', 'venue' and 'article' stored in the database fine.  I can pull entries out and display them fine.  I now want to edit them using a browser.  So I thought I would use the same form I used to add mySQL entries and change ti so that it loads in the article into the form fields depending on the id.  (This is chosen through a link saying 'edit). Code:

View Replies !
Passing A Parameter From An HTML Page To A PHP Page
I want to pass a language value (EN/FR/DE etc.) from an Index HTML page to a PHP page with a language code in the call, so that the PHP page can select texts in that language. I would like to to it from an unordered list item if possible by extending the link ... <li><a href="scripts/pricelist.php???>Pricelist[/url]</li>

View Replies !
Passing Variables From Page To Page
I just need to know how to pass variables from page to page on my form.

View Replies !
Passing Variables From A Page To An ASP Page?
I have a site using a PHP CMS and I need it to use an ASP module from
another site but I would like to use a frame so it looks like it is
still in the same site.

I need to pass a username variable from a form in in the PHP webspace
(where the domain is pointing) to a page in an ASP webspace (using a
subdomain not related to the main domain).

I created a frame page in the php hosting with a 1px top frame and the
main frame pointing to the asp page but of course the variable is not
being passed.....if I put the ASP connection code on the frameset page
it doesn't recognize it because the hosting is a Unix/PHP hosting
only.

My question to you is:

Can a variable be passed from the php to the ASP webspace using some
other technique?

I just need to have the ASP module showing as if it is in the PHP.

View Replies !
Not Passing My Variable
I have a session variable that looks like this.

View Replies !
CGI Variable Passing?
Using the cgi PHP binary in the #!/usr/bin/php shell script fashion, is there any way to pass variables such as the usual $1 $2 $3 sh?

View Replies !
Passing Of Variable
I declared my variable as global and used it to hold a query result but the variable is not passing its value to another php page where I need it again for another query something like this:

1st php page:
global $comp

$result = "Select Company from dbtable where Name = ABC";
$comp = $mysql_query($result);

2nd php page:
$query = "Select Branch from dbtable2 where Company = '$comp'";

View Replies !
Passing Variable To Url.....
Let say i am to pass avariable with its value to an url using php,like

www.mycom.com.my?id=<?php echo "$id"; ?>

then, the url will display the address with www.mycom.com.my?id=1234 right? So, is it a way to hide the variable and value?

View Replies !
Variable Passing Through URL?
This part of my scripts doesn't work: PHP Code:

View Replies !
Passing URL Variable Into DB
I am using php with mysql. I am trying to develop a website that will pass a URL into a database. I recieve the variable in the url as id=1727719 and want it to be inserted into the id field of my database.

View Replies !
Variable Not Passing Through
Have a form that loads database information which could then be modified to update the database with the new information. The date changes fine, but the newcomments is not being past to the posthp.php. Code:

View Replies !
Passing Of A Variable...
I need to pass off certain variables if the room number equals a certain number, (the big huge long lines....) problem is, when it does, it sets the variable to 0 and doesn't set it back after the query is completed. so every 100 increments on rnum, it goes back to blank and starts again from one... anyone see why it's not working? Code:

View Replies !
Variable Passing
Just wondering.. if I have this line:

<input name="UserName" type="text" id="UserName" size="45" maxlength="25" />

How do I get a php variable get the value from the HTML variable?

Can I do:

$var1 = 'UserName';

View Replies !
Passing A Variable
i use a language file, where all my variables are declared ( english.php ).

on my index.php page i use $_GET to select the language.. so that is
index.php?lng=english

my question is how can i transmit my variable $lng to my other pages.. i know that it might seem a very dumn question to you.. but.. i'm just learning.

View Replies !
Passing In URL Variable
How do you pass in a variable via URL without a pre-built static array? I know this has to be possible somehow because it's used in all sorts of scripts, especially forums, like with topic IDs and what not. The script I'm working on right now passes the name of a script in to a download.php file, then it uses that to find the right row in a MySQL database marked with the same name, to add one to the download count and fetch the filename to download.

View Replies !
Passing Get Variable
know how to pass the "GET" variable into an iframe. I have the URL as

http://com/search.php?s=term

I would like to pass the GET variable "s" into an iframe.

View Replies !
Passing A Variable From PHP
Code:

<?
$name="Mohamed";
echo $name;
?>
<script language="Javascript1.2">
var na=<? echo $name; ?> ;
alert("Welcome "+na);
</script>

Why there is no messagebox running here? Is there any possible way to pass a variable value from PHP to Javascript.

View Replies !
Passing This Variable
I have a variable in index.php named $var1, I'm trying to pass it to users.php. I use a function to change the page though, which in the end does this:

<meta http-equiv="Refresh" content="0;URL="users.php">

View Replies !
Passing Variable Via URL
I am passing a variable from one page via the URL and requesting it on another page -> $_REQUEST['id1']; I need to gave this data and then pass it to another page.

View Replies !
Passing Variable
It's kind of late, but I have just updated my PHP from 4.1.x to 4.3.3. I use all the old codes, but PHP 4.3.3 do not take my passing variable. example:

$folder='aaa'
echo "<A href=photo.php?fd=$folder>album</a>";

in photo.php, when I use $fd, errors come out. Notice: Undefined variable: fd in photos.php.

View Replies !
Passing Variable In A Class
This script asks for a username, and asks for an image, uploads the image, then resizes and blah blah blah. But For some reason,
$this->autoImage has a value but $this->autoImage_name doesn't!! Hope someone can shed some light! Thanks in advance

<?php

$main = NEW butchAdmin;
class butchgrobAdmin{
function butchgrobAdmin(){

global $action_id,$autoImage,$user,$my_pass,$upload;

$this->action_id = $action_id;
$this->autoImage = $autoImage;
$this->autoImage_name = $autoImage_name;
$this->user = $user;
$this->upload = $upload;

switch($action_id){
case 1:
//do this
break;
default:
$do_now = $this->image_resize();
break;
}

}
function image_resize(){

if ($this->upload){
echo $this->autoImage_name ;
//exit;
// Get image sizes
$image_size = GetImageSize($this->autoImage);
$imagewidth = $image_size[0];
$imageheight = $image_size[1];
// Set new image size
$new_w = $imagewidth / 2;
$new_h = $imageheight / 2;

$dst_img = ImageCreate($new_w,$new_h);
$src_img = ImageCreateFromjpeg($this->autoImage);

ImageCopyResized($dst_img,$src_img,0,0,0,0,$new_w,$new_h,ImageSX($src_img),ImageSY($src_img));
$new_img = Imagejpeg($dst_img,$this->autoImage_name,40);

if($new_img){echo"User: ".$this->user.", Successfully resized and saved ".$this->autoImage_name." to harddisk<br><img border=&#390;' src='".$this->autoImage_name."'>";}

} else {
// Aquire Image
?>
<form method='post' enctype='multipart/form-data' action="<?php echo $PHP_SELF; ?>">
<font>Username:</font><input type='text' name='user'><br>
<input type='file' name='autoImage'><br>
<input type='submit' name='upload' value='Upload Images'>
</form>
<?php
}
}// End FUNCTION image_resize()

}// End Class
?>

View Replies !
Passing Variable From One Script To Another?
i should preface this by saying that i am very much a php beginner. anyway, i have a script that pulls the first 5 rows out of a mySQL table and displays them, like this:

$limit=0,5;
$query="SELECT * FROM contacts LIMIT $limit";

i would like to have a "next five results" button at the bottom of the page, and it seems like the way to do this is by using the same script, only with $limit changed to 4,5 so the offset starts at the 5th record. i can use the same script, only with $limit changed. essentially, what i can't figure out is how to pass a variable from one script to the next. is it done with the URL somehow? cookie?
does that make sense? thanks for any help!

View Replies !
Passing A Hidden Variable
Is there anyway to pass a hidden variable, as in a form, with urls, without having to add massive lines of code to my pages?

I basically want each page to check for a variable, and if not found, default to 1. if the user clicks on the other setting, then the variable is passed as 2 on all the subsequent pages (and if clicking on the original setting from there.. continue through with 1 as the variable).

I've checked out a few options already, but none worked out. i don't want to use sessions or cookies. $_GET seemed like the answer, but i don't see how to pass it.

View Replies !
Passing A Variable From PHP To Flash
How do I pass a variable from a PHP script that already contains
a Variable - to my flash movie ?

E.g.

$Access = True

Now when the Flash movie opens for the first time I want to read the content of $Access...if its true or false - to give user access to view the movie or not.

View Replies !
Passing Variable Not Using Form?
I am thinking of passing variable to another page not using form format. there are many links displayed in, say page1.php
when ppl clicking the link, the ID of the link will be send to another page, page2.php, so that page2.php can display the content according to the ID received.

View Replies !
Passing Variable To Popup
I am querying a database and returning job listings. I want the user to be able to click on a listing and view the job requirements and description in a popup window. I am using a javascript function to open the popup window. When I try to pass my id variable into the url, it is passing the id of the last record. In other words, all job descriptions are being given the same id instead of their unique id.

How do I pass the unique id through the url? I can get it to work using target="_blank", but I do not want to do this because I cannot control the window paremeters. Code:

View Replies !
Passing Variable & SQL Queries
I am having some trouble passing a variable from one page to another.

What I would like to do is pull data from table 1 - a list of categories - which will be clickable.
Then when the category is clicked the data from table 2 – the relative links – will be displayed dynamically.

I can display the links in a separate page, this is not the problem. Where I fall down is doing this all dynamically, adding the needed SQL statements.
I am essentially trying to build a really simple links directory - like DMOZ.

View Replies !
Passing Variable To Functions
I have these two arrays and the function to print it using the index PHP Code:

View Replies !
Passing Javascript Variable To Php ?
The code below is aimed at passing the date in the yyyyMMdd format
from the javascript calendar in an html file to the php in a another
file which then searches a MySQL database.

For some reason the sendPhp is not working.

I need to send

target=frameright (as the results of the next.php search appear in the
right hand frame), and

submit=1

View Replies !
Passing A Variable By Url Not Working
on my main page, i've got this link: Code:

<a href="content.php?id=news" target="bwaContent">news</a>

and this is the only script in content.php (this is between html header and footer): Code:

<?php print( "$id<br>" );?>

yet, whenever content.php is loaded, nothing is printed. am i missing something?

View Replies !
Pagination Variable Passing
I have this code that paginates the results, that works fine, but when I try and click the links to view the rest of the results, the catagory variable isn't passed to the next query, so the results come back as zero, how do I pass the variable to the next query?
PHP Code:

View Replies !
Passing Variable Without Using FORM
I have a text box and a image button. I want to pass whatever the user has typed in the box to another file, in a new window, using window.open (...) command. I don't want to use FORM because I don't want the page to reload.

View Replies !
Passing Variable To A Function
i have this : $uname=$bbuserinfo[username];

how can i pass the value of the $uname into a function? PHP Code:

View Replies !
Passing Variable From One Php File To Another?
I am wondering how to pass one variable from one php file to another
continuously or discontinuously.
For example, variable $a is declared in file1.php. I like to use that
variable in file2.php or file3.php where in file2.html, I won't use
that variable.

View Replies !
Passing A Variable To HTML
I have a standard HTML page. After user authetication, i would like to send the user name from MySQL Database to The standard HTML page. The new HTML page will display the name of the user and the common contets for the user.

View Replies !
Passing Variable Values With The Url
I have made a simple php script that multiplies two variable x and y. x and y are both the value of 0 and when I run the script the result is 0. I then changed the value of x and y to x=3 and y=5 and my answer was 15. All these tests prove to me that the php is working on my Xitami server.

I then tried to enter the values for the variables through the url but it doesn't change anything on the browser, I mean I keep getting 15 even after I entered x=1 and y =2 on to the url.

View Replies !
Passing Variable Using Url - What's Wrong?
I want to send a variable to my script using url.
I don't know why but echo in "szczegoly.php" display nothing...

// strona1.php
<A HREF="./szczegoly.php?nazwah=$nazwa_hotelu">$nazwa_hotelu</A>

//szczegoly.php
<?php
echo "<p>{$_GET['nazwah']}</p>";
?>

View Replies !
Passing A Variable From A Form To Php
I don't seem to be able to send trough the variable 'language' from my
form to the php-variable $language that I want to use in my session...
I first tried in the form with a drop down menu (select) and now with
radio-buttons but it won't work... What am I doing wrong?
BTW: the variable 'toevoegen' is passed correctly from the form to the
php.

<?php

session_start();
session_register('language');

echo("Taal is $language <p/>");
echo("Toevoegen=$toevoegen <p/>");
if (!IsSet($language)){

$result = mysql_query("SELECT * FROM languages ORDER BY mylanguage");
if (!$result) {
echo("<P><b>Fout bij uitvoeren query: </b>" .
mysql_error() . "</P>");
exit();
}
echo("<FORM ACTION='$PHP_SELF' METHOD='POST'><INPUT TYPE='hidden'
NAME='toevoegen' VALUE=&#391;'>");
while (($row = mysql_fetch_array($result))){
echo("<INPUT TYPE='radio' NAME='language'>".$row["mylanguage"]);
}
echo("<INPUT TYPE='submit' NAME='kies_taal' VALUE='Choose
language...'>");
echo("</FORM>");
}

else{
echo("Uw taal is $language !");
}
?>

View Replies !
Passing A Variable Into A Script Via URL?
I have one page that enables users to pick a name of the artist they want to check out all the listings for, and each artist has a unique artistid of course... now, if I pass something like <a href=artist.php?artistid=$row[artistid]> and the URL ends up being something like http://www.mysite.com/artist.php?artistid=1 I can't get any output from that artist.php page... here is what the artist.php looks like: PHP Code:

View Replies !
Basic Variable Passing
I am setting up a web form that will take data and pass it along to a
PHP script. I am noticing that the PHP doesn't get the information from
the HTML, or at least isn't displaying it. I set up a basic "test"
HTML/PHP combo. Here is what I have for the HTML:

<html>
<head>
</head>
<body>
<form method=post action="test.php">
<INPUT NAME="Author" TYPE="text">
<input type=Submit >
</form>
</body>
</html>

Here is what I have for the PHP:

<html>
<head>
</head>
<body>
<?php
echo $Author;
?>
</body>
</html>

View Replies !
Passing Variable With Brackets
Can this $msg[] be passed as is and = $msg[] when passed or will it just =$msg?

View Replies !
Error When Passing An Url Variable
when i pass a variable through the url i keep getting an 404 error page

like  www.yoursite.com/page.php
works great but

www.yoursite.com/page.php&pid=3
just gives me an error 404 page

View Replies !
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.

View Replies !

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