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




Display Selected Record That Has Been Passed To URL


I have a page which can list all records from a table in my local database.

For each record that is displayed there is link next to it. When the link is
pressed another page opens up and the ID (automated primary key in my table)
of the record selected is passed to the URL.

So now the URL looks something like this:

http://localhost/Webpages/newpage.php?recordID=3

How do I display the details of the record that has been selected on this
new page?




View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
1 Record In Database But 2 Records Were Selected?
i'm retrieving a record from database. below the record, i have a yes and no button, where i can let user click and then count the number of yes and no.

everything works fine, but when i start to click the yes or no button, my record ,becomes two records. i only have one record in my database, but two same record was displayed.
this is the code: PHP Code:

Transferring The Selected Record From The List Box To Textbox
Breifly, I've 3 list boxes.Select a record from the first one, click a button, the second list box is filled and select a record now and then click a button, the third list box is filled.Now, select the record, the selected record has to be shown in the text box.But, I also want to show one more field related to this one in another text box.How can i do??

well, the first list box shows the topic names, 2nd one the sub-topic names and the third one the article names. Now, when i select the article name, the article name and the article content has to be shown in the text boxes.

If its just article name, i know how to do it by java-script but i also need article content to be shown. Could somebody please help me how should i modify my code and where should i insert the text boxes?? Also, one more question, If i make any changes to the data in the text boxes, i would like to update.How can i do that?? PHP Code:

Display The Content That Is Selected From The Dropdow
what im trying to do is, i have a drop down that displays all the files that are in the directory when the page loads. when a item is selected from the drop down list i want that file to load in the text area but i cannot get it to work, can someone tell me what im doing wrong? Code:

Display All Or Selected Data Based On An IF Condition
I am trying to display all and selected data based on an IF condition. It will either execute all the data from the table or selected data based on category. well at least it is supposed too. I can take out the select * query and it will work but I need to use both.

And I want the page to load all the data from the table on reload or load and when someone selects the list box and hits submit it will only display the selected ones on a web page.  Its probably something simple but I cant see why I dont get any results to display. Code:

Won't Display More Than One Record
I'm trying to display a list of users attached to a team, then for each user I need to pull their country and PSN and display it in the same table. Here's my current code:

Display Database Record
i have a php script that read from mysql and display then in textbox.
I have problem with the way textbox display the data.

<input type=text name="package_name" size=20 maxlength=10
value='.$package['package_name'].'>

when the package_name is 'china tour' it will only show china in the
text box. How can i show all the content of the record?

How To Display The Record Into Pages?
I'm having (for eg., 22 records) in my MySQL table. I want to display these 22 records into pages, each page contains 5 records. so 5 pages with each 5 records and the last page contains only 2 records, and Previous and Next links in each page.

I've used LIMIT in select statement. But i dont know how to use this exactly.

Display 1 Record At A Time
Now, I display all the questions which are in the table.I would like to show one question at a time and provide a submit button and when the user submits it, i would like to show the answer and then proceed to the next question. I guess i need to add some few lines in-order to check this and there will be only 5 questions. PHP Code:

How To Display First Record In Bold
I'm pulling news titles from MySQL. How Can I display first record in
bold (different than other ones). What is the best way to do that. Is
there some 'magic' query or PHP function.

*First Headline*
Second Headline
Third Headline

How Display All The Record Of A Certain Field In A Combobox
How can I display all the record of a certain field in a combobox after I
have connected to a db in mysql ?

Automatically Change To Display The Next Record
I have a page which displays a single record on a page each time from a mysql database. there are 10 records in total in the database.

What I would like to do, is rather than have the user click a link to display the next/previous record I would like the record to be displayed for a certain length of time (say 20 seconds) and then automatically move on to display the next record. When it has reached the last record, I would like it to loop round again from the start.
Any ideas on the best way to achieve this?

Make Selected Option Stay Selected In A Combo After Submit
I have 3 comboboxes, one for the day, other for the month and another one for the year. Every time i select a value for the three of them and press the "Submit" button, they reset to the default option. Anyway this can be solved?

Multiple Selected="selected" In A List.
I have a database with 1 to many and the many is a list with multiple
selects in a list. When I click on a master record I have as part of
my form the select statement for the multiple choice list. I want the
list to highlight the multiple chosen values. here is part of the
code.

$dresscat = specdresscat($dresstypeid); //this is the query to get the
values in the detail table
$drcatrow = pg_fetch_array($dresscat);// the array for the detail
table.
<select name="stages[]" multiple="multiple">
<?php
$allstages = allstages(); // this is a function to query my database
to get the value for the list.
while ($allstagerows=pg_fetch_array($allstages)) {
$eachstage= $allstagerows["stageid"];
$specstage= $drcatrow["stageid"]; // this is the point I need help
if ($specstage == $eachstage){ ?>
<option value=<?php echo $eachstage;?> selected="selected"><?php echo
allstagerows["stage"]?></option>
<?php }else{ ?>
<option value=<?php echo $eachstage;?>><?php echo
$allstagerows["stage"]?></option>
<?php
}
}
?>
</select>

Compare Record With Session Variable And Update Record If Different
I'm trying to figure out how to create a session variable from a recordset field value in a mySQL database and compare this with subsequent values from the same field each time the page reloads. When the value of the field changes (as a result of a user update) I want to trigger an event (redirecting to another page). It's probably a very basic PHP function but I am a newbie with this language.


How Many Arguments Passed???
is there a function or method, where i can get the number of arguments passed to a function.? i know that there is a function called func_num_args, but it seams that this function have to be called from within the function, and that was not what i wanted.

XML Being Passed To PHP Via POST
I am using macromeda Flash to create anXML object which I pass to PHP.
I need to know how to recieve it into PHP so I can process it in PHP.
For now all I want to do is display the XML on the screen.

To start at the simplest point I am trying this:

$my_xml = $_POST;
echo $my_xml;

Of course all it echos is "Array"

If I have tried a few other things, but I am shooting in the dark.

Data Not Being Passed Into Db
I have this code to enter stuff into my db, When someone views a profile it's supposed to add 1 to the views column but it doesn't. Code:

Only One Session Variable Passed On...
I have a problem in a login thingy (again). Only the first session variable is passed along to the next page...

Stopping Spaces From Getting Passed
I have a simple little form that takes the name and a comment, and adds it to a table. I want to know if there is a way to prevent someone from just entering spaces, and having that get entered as their name. I have the if statement check for $name == '' - but the names entered as just spaces get by it.

Can One Get The Name Of Parameters Passed To A Function?
One thing I like about Ruby is the use of symbols when passing
function parameters to a function. One thing I dislike about PHP is
that if a function has 4 optional parameters but you want to do
something with the 4th one, you need to put in something, perhaps
empty strings, for the first 3 parameters, even though you've no
interest in using them.

I'm wondering if there is anyway to emulate the Ruby style with
something like this:

http://us2.php.net/manual/en/function.func-get-args.php

Is there a way to get the parameters as an associative array? A
numerically indexed array is just as useless as the normal style of
passing arguments.

Array Passed To Dispay_table()
how to process the array passed to dispay_table(). The idea being that i can pass any number of fields in the array and have them output. Any ideas on how this can be done?

$sql = mysql_query("SELECT * FROM whatever");
$table = new CreateTable();
$table->display_table($sql, "field1, field2, field2");
function display_table($sql, $fields){
while($result = mysql_fetch_array($sql)){
// I'm trying to get all the values of // the fields array to dispay here.
// i.e. $result[field1]
}}

How To Process The Passed Value In Php3?
one of my php3 page passes values to another php3 page. "www.mydomain.com/searchit.php3?variable=value" What are the commands to get/process the passed value? both the scripts or PHP3.

Can $this Be Passed As A Method Parameter?
In a class, can $this be passed by reference or value?

function setDatabaseObject("MySql", $this) {
// some code here checks the name of the
// class of the object that is calling this method
}

For security, and to enforce naming conventions, I'd like for some of
my objects to only be callable from certain classes, but the only way
I can think for an object to get the name of the calling code is if I
had in the $this keyword.

Variable Passed In Through Header
We recently upgraded PHP and variables that were once passed through the URL are no longer
recognized.

Example:

http://www.sun.com/test.php?defectID=2

Within the test.php code:

<?php
session_start();

$defectID = (int)$defectID;

if ( $defectID != 2 ) {
// This should not execute, but does.
echo "Error: $defectID";
exit;
}

?>

Can URL Parms Be Passed To A PHP Script?
Will the following pass parms "Color" and "Contrast" to the PHP script? If so, how does one
retrieve the parms within the script?

http://xyz.com/script.php?Color=blue&Contrast=weak

Variables Passed Between Functions
I have a function that fills the value field of a form with 2 possible variables but they are not getting set so when you view source you just see value=""

I also try echoing these variables to see if they are getting set but they are not.  Is it becuase they need to be set to global? Code:

Figuring Out When 2 Hours Have Passed
What I'd like to do is this.  get a date and time and determine if it has been a certain amount of time since then.  For example, I make an entry in the database of 11:00pm, and I want to periodically check, and if it is 1:00am or later, then I would update the database.  Any suggestions?

Date Has Passed Function
I have dates in my db which are stored as strings like this 08/01/2007 and i am trying to write a script which either says the date i pass in is in the future or in the past.

Only Enter Results If Date Has Passed
I have a PHP match result system. I do not want the user to enter the result if the date has not passed. If the date has passed then $played = 'Yes', If not then $played = 'No'.

I read the date and time values of the match from the database. I then need to validate them. I could use the system clock BUT somebody could simply move the date on their machine to beat the system! Is there any other way to solve this?

Variables Not Passed From Url Or Form To Page
I use a Mac at home running OSX 10.2, and use the Apache PHP MySQL trio for developing and testing sites. I've had very good experiences with this setup and have had no major problems till now.

I noticed recently that variables added to the end of the url (the get method, ...url/page.php?var=value) are not passed to the script within the page. Forms using either the get or post method have the same problem. For example, a page named "foobar.php" containing this: Code:

How To Quit A Function If All Paramters Not Passed
Is there a way to quit a function if all the parameters are not passed to the funtion ie

Function One ($two,$three) {
.......
}

if either one of the two vars are not passed then dont execute the function , i was just wondering if there was a Generic PHP function which will work for all functions i know how to do it for indivdual functions ie , by just checking for the vars.

Input Type=image Value Not Passed
I know this is really an HTML question, but a bunch of <i>designers</i> are not going to know the answer to this (yes, I know some programmers hang out there as well).

Anyway, does the input type 'image' not support a value??? I've got the typical form with two input types and the client wanted to change the buttons to images. No problem. But now my script doesn't work and I checked and the values assigned to the images are not being passed when the image is clicked. Is this normal or am I missing something?
AND, if it IS normal, how do I work around it???

Passed Variables In Included Files
I'm looking for a guide on how variables are handled in included files. A pitfall I've run into is that if I define a variable, then include a file, the variable can be displayed on the included file. But if I try to call that same variables on the included page within a function, the variable is undefined. Example: PHP Code:

Values In Form Not Passed Using Onclick ?
i have a php file name main.php i want to do a post and not a get since this action is to delete a row in the database. however, when i try to do a href onclick, the values are not passed to the main.php. why ? Code:

echo "You have " .$votesattach. " votes for this quote. Delete the Quote and Votes ?";
echo "<form name=send1 method=post action=main.php?action='deleteit'>";
echo "<input type=hidden name=action value=deleteit>";
echo "<input type=hidden name=which value=$delete>";
echo "<input type=hidden name=userno value=$userno></form>";
echo "<a href=main.php onclick=document.send1.submit()>YES</a>";}

how do i do pass values to the server using a post method ?

Function With Reference-passed Variabel
Are there somebody, who can tell me, what I'm doing wrong with this
function:
function hej($q, &$h) {
if ($q == 0) {
return true;
$h = 'Hello'
} else {
return false;
$h = 'Goodbye'
}
}

$rt = hej(0, &$a);
if ($rt==true) { echo 'Hej' }
else { echo 'Farvel' }
print_r($a);
echo "<br />
";

Recovering Parameters Passed With URL On The Receiving PHP End
If I pass parameters to a PHP script in URL like

..php?a=aa&b=bb
how do I recover them on the receiving PHP end?
I looked at the list of PHP Variables using phpinfo() and found nothing
suitable

Varaible Passed Through URL Is Not In $_GET Array
I am passing a variable through url.
www.example.com/maxmoney.php?id=xyz@yahoo.com

In the maxmoney.php I have tried to catch it this way
$email=$_GET['id'];
when i echoed $email or $_GET['id']; its not displaying.

I am using php 5. I could not figure out what the issue is.

Accessing A Passed Variable's Previous Name
I want to pass a variable to a function and have that function add it to an array, using the variable's name (before it was passed) without the dollar sign as the key.
So. Code:

When A Value Passed In Form Or Q'string Is Empty..
I am trying to figure out how to deal with when not all elements
in a submitted form are filled out or when page expects a query string
and doesn't get one.. I tried the two conditionals below, but still got
errors:

$param= $_GET['msg'];

/*
if ($param != "") {
echo $param;
}
*/

if (isset($param)) {
echo $param;
}

query string is:

home.php?msg=selected records have been deleted from the database.

(referrer pg is not always pg sending query string.. so need to deal
w/when no query string is passed..)

Hiding Passed Variable In The Address Bar
when i pass values from the link like this

<a href="reservation.php?myseldate=1".'-'.$month_curr.'-'.$year_curr."">Click here</a>
then in the address bar it shows

http://localhost/pankopat/reservation.php?myseldate=1-9-2007

if the user alters the value of date and change 1-9-2007 to 2-9-2007 (or any other thing) then that value gets saved in the database..

Is it possible to hide this value in the address bar or make it uneditable..

Variable Being Passed From Site Into PhpBB
I am creating an autologin feature where my site members are logged into the bulletin board automaticly

the only variable I find that is global is $sAuth

it stores the members id #... I can user this to pull the name and password out of the database and set name and password in the forum to eaqual these... is this a security issue?

or can $sAuth only be set by script on my site??? I am rather new and want to make sure this variable can not be asigned in another way.

Showing A Different Page When A Variable Is Passed
this is the code i have just now

<? include 'code.php' ?> //where variables are kept

<?
$welcome = $_REQUEST['welcome'];
$leave = $_REQUEST['leave'];
if ( $welcome )
echo $page['welcome'];
if ( $leave ) {
echo $page['leave']; {
} else {
echo $page['redirect'];
}?>

what i want to do is, if the variable passed is "welome" i want it to show a welcome page and if "leave" is passed i want it to show a leave page, and when no variable is passed i want it to redirect to a totally different page

like this:
index.php?welcome
Show welcome page

index.php?leave
show leaving page

index.php
redirect to a different page

Passed Variable Not Working In An If Statement
I am setting up a website where students can login and browse their course information and handouts.

I have set up a database with there courses in and have managed to get each students courses to appear after they have logged in correctly.  The course shows as a hyper link and is passed to a page where an if statement checks which course it is and then directs them to the relevant page. Code:

How To Extract Variable Passed With Get Method
I want to extract the variable below and assign it as  $bActive = $_Get["name"];
Something is just not working as $bActive produces an empty array. Please help.

Quoteecho "  <td><input type="checkbox" name="active_".$key.""value="active"";Thanks.

Ensure A Variable Passed Through Through URL Exists?
It just donned on me that I need an error message if someone tries to go to a page with a variable in the URL that doesn't correspond to a database entry.

For example, http://www.domain.com/poetry.php?piece=4 does not yet exist. Say I only have three poems in the database right now. What are some ways (or the best way) to make sure the variable leads to content or to otherwise display an error message?

No Database Selected
what I've got it a simple system that includes pages the reference to which are in a database. This bit worked a treat. until i tried to put something that did some work in one of the included pages. PHP Code:

Selected Box Action
how to set the respond to action when user choose an option inside a <select></select> box? eg. when user select an option in the <select> box then php search for data inside mysql and then display the required data on the <input type=text>.

Php Dropdown - Selected?
i'm using this to pull information from a database and display it in a dropdown list. The problem is I am using the name code when I goto the "Update" page, but i'm not sure how to add the "selected" field, that way what ever I saved in the database will load.

Example: I goto add and it add's the "id" of 7 to the field, when I load the page again it auto's back to 1 instead of clicking in-to 7 as thats whats already there... = ) Code:

PHP Not Populating Form Variables Passed Through POST Or GET
I"m running:

Windows Xp SP2
Apache2
PHP5
MySQL4

Everything seems fine and dandy, and I can do scripting on server side, but for some reason I cannot get data from a form to be put into a variable.

I have a simple form in an html page which submits, and in the php script that handles the input, none of the data in the form is going into the variables.

My php.ini file does have all the GPC's in place(ie variable_order, the way they get processed).


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