Help me dig out of a mini-nightmare. Some parameters transfer, others do not.

Help me dig out of a mini-nightmare. Some parameters transfer, others do not.

am 28.07.2010 07:13:53 von Bill Mudry

--=====================_5796747==.ALT
Content-Type: text/plain; charset="us-ascii"; format=flowed

Along with suggestions from this group, I was able to transfer
parameters across html pages so that
a user could pick a wood species and the new page would faithfully
report details on that wood.
Later (with help from the group again) I was so glad to see that
these pages were able to pick up
JPEG scans of how some woods look like, one more important step
forward for the project. When I then added a form for users to choose
what extra data they wanted to see and it would recycle to
the same page, the scan picture would disappear. A suggestion of
adding a hidden field in the form
even fixed that :-) . Things went swimmingly for a while.

I don't know just what I did wrong but somewhere between trying to
add some Javascript to create
new pop ups (they even work now, too) for user choices for showing
other photos, I messed up the page bad enough that it took a few days
to even get everything showing up again. Well .... almost everything.

It is able to pick up the choice of botanical name that a user
chooses from a very large list of woods and display the text data for
that one wood just fine again on another page. What I cannot seem to
get back again is to show the wood scans for those woods for which I
have scans (.... literally scanned on a scanner, btw, instead of a camera).

I have temporarily hard coded a full path and file name for a typical
wood that should have a picture
to show .... and the scan shows up just great, proving that part of
the logic is still intact, fine and working. The problem seems to be
for some reason that I no longer understand in getting the name and
partial path of the scan file to show up via the super-globals.

Both the botanical name ('species_name') and the scan picture name
('picture_filename1')
are stored in the table 'species'. The scans actually have a gallery
folder as part of what is stored
(eg. "gallery_a/ablies_alba, gallery_b/betula_nigra, and so on).

I have tried using (parse_str($_SERVER['QUERY_STRING'], $qs). I have
tried using $_GET that
has worked well before ..... but to no avail. I did try experimenting
quite a bit before finally and
with some regret deciding I am past what I know on why NOW
(remembering this used to work)
I just cannot get the content from column picture_file1 to come
across also. I keep saying it SHOULD
work.... but it doesn't.

With more and more functions being installed on this page, I will
still put the whole page code,
even though it will have sections that need no attention ... just to
be on the cautious side. This seems
so elementary and yet I cannot get it to work. (bear with so many
commented statements .... stabs
at getting this to work).

Three steps forward ..... one step back ......

Bill Mudry

============================================================ ============






parse_str($_SERVER['QUERY_STRING'], $qs);
$species_name=$qs['species_name'];

Echo "on line18 \$qs is - $qs
";

parse_str($_SERVER['QUERY_STRING'], $qs2);
$picture_filename1 = $qs2['picture_filename1'];

Echo "on line 21 \$picture_filename is - $picture_filename
";

//$picture_filename1=$qs['picture_filename1'];

//$picture_filename = $_GET['picture_filename'];

$species_commonname = $_GET['species_commonname'];

//echo "\$species_commonname value at line 24 is - $species_commonname
";



#
//////////////////////////////////////////////////////////// ////////////////////////
# CONNECT TO DATABASE
#
//////////////////////////////////////////////////////////// ////////////////////////


include ("connecttotaxa.php");
$connection = mysql_connect($hostname, $username, $password)
or die("Unable to connect to database server");

$db = mysql_select_db($dbname, $connection)
or die("Unable to connect to database");


/*
------------------------------------------------------------ --------------------
HOPEFULLY CONNECTED AT THIS POINT
------------------------------------------------------------ ----------------------

*/


$query6 = "SELECT * FROM species WHERE species_name='$species_name'";
//var_dump($query6);
$result6 = mysql_query($query6)
or die(mysql_error());


If ($result6)
{
$row6=mysql_fetch_array($result6, MYSQL_ASSOC);
Echo "\$row6 is - $row6
\n";
Echo MYSQL_ERROR();
};
/*
if ($row6){
$z=extract($row6); //Echo MYSQL_ERROR();
};
*/


?>






Echo "Data on a specific chosen botanical species <br /> $species_name ." ;
//Echo "";


?>
















bgcolor='antiquewhite' border='5' bordercolor='navy' width='800'>









The programming works well now but there is a lot of data to
be stored.
It is a huge job that will take a long time to get
most of it in. Till then, there may seem
to be a lot of data missing --- because there is!



This species area is still under development. It is the
bottom of the botanical tree.
No further elements are under species. There are
three categories for species data;
GENERAL DATA, WOODWORKING DATA AND NUMERIC TEST
DATA. General Data will always be
shown while future programming will let the reader
choose if woodworking or numeric test data shows.




Some species will have a lot of information for them, a few
even for all three data areas. The species that TAXA
reports ranges from massive wood from the largest trees in the
world weighing tons to ssmall shrubs that are
"woody" but without enough wood to be used for anything other
than academic interest. Some woods have been
researched and tested thoroughly while others are amongst the
thousands that are only known by some basic facts.
This shows why some data areas are rich with text and pictures
while others have very little known about them.
For such rare, obscure or small sized species, listing
woodworking or numeric test data is neither practical or
useful.



General Information

Basic information on wood any reader would want.
Always present.

Woodworking Information

Optional information on what a wood is like to use
and work with.

Of interest for anyone who will work with a wood.

Numeric Test Information

Optional information on lab test results.

Largely of interest to architects, engineers and
researchers. Data is less common.

















>


value="Photomicrographs" onClick="NewWin=window.open('show_photomicros.htm',
'toolbar=no, status=no, width=200,
height=150, resize=yes'); ">


onClick="NewWin.close();">





onClick="NewWin=window.open('show_more_photos.htm',
'toolbar=no, status=no, width=200,
height=150, resize=yes'); ">


onClick="NewWin.close();">









onClick="NewWin.close();">













//////////////////////////////////////////////////////////// //////////////////////////////////////////
// Start
of reporting general data.
//////////////////////////////////////////////////////////// //////////////////////////////////////////


Echo " border='2' bordercolor='saddlebrown' width='800'>";
Echo "";
Echo "";
Echo "";
Echo "";
Echo "";
Echo "";
Echo "";
Echo "";
Echo "";
Echo "";
Echo "";
Echo "";
Echo "";
Echo "";
Echo "";
Echo "";
Echo "";
Echo "";
Echo "";
Echo "";
Echo "";
Echo "";
Echo "";
Echo "";
Echo "";
Echo "";
Echo "";
Echo "";
Echo "";
Echo "";
Echo "";
Echo "";
Echo "";
Echo "";
Echo "";
Echo "";
Echo "";
Echo "";
Echo "";
Echo "";
Echo "";
Echo "";



Echo "

General Data for
Species $species_name

Authority - $authorities_speciesVarieties, cultivars, Hybrids, Subspecies -

\n $varieties
Common Names - $species_commonnameSynonyms - $syn_species
Gymnosperm or Angiosperm? $gymno_angioCommercial wood? - $commercial_wood
Uses - $species_usesDurability - $durability
Plant forms - $species_life_formTypical sizes of plant - $species_lifeform_size
Seasoning - $seasoningStability - . $stability
General Description -
$species_description
Typical Defects - $defects
Toxicity - $toxicity
World Distribution - $location
Comments - $comments


\n"; //Close off data table;

Echo "

";



//////////////////////////////////////////////////////////// //////////////////////////////////////////
//
// Let users decide if they wish to view woodworking
and/or numeric test data.
//
//////////////////////////////////////////////////////////// //////////////////////////////////////////

//$show_woodworking = "off";
//$show_numeric = "off";

?>



Choose if you wish to also view Woodworking or
Numeric Data













Show Woodworking Data


Show Numeric Test Data


echo " value='{$species_name}' />";
?>







////////////////////////////////////////////////////////
// END OF FORM, START OF PROCESSING USER INPUT
////////////////////////////////////////////////////////

//$display_working_data =""; // initialize responses to empty before
retrieving them
//$display_numeric_data ="";

//Echo "line 254 \$display_working_data is - $display_working_data ";
//Echo "
";
//Echo "line 256 \$display_numeric_data is - $display_numeric_data ";
//Echo "
";

//bring in user's answers from form:
$display_working_data = $_GET['show_woodworking'];
$display_numeric_data = $_GET['show_numeric'];

//check what user responses are:
//echo "Line 269 - \$display_working_data is - $display_working_data
";
//Echo "line 270 - \$display_numeric_data is - $display_numeric_data
";

if ($display_working_data) {
Echo "line 269 - \$display_working_data is - $display_working_data ";
Echo "
";
include "./woodworking_data.php";
}
else {
Echo "Working data chosen not to show

";
// echo "Line 274 - \$display_working_data is -
$display_working_data
";

};

// echo "working_data is - $display_working_data";

//Echo "line 282 - \$display_numeric_data is - $display_numeric_data ";


if ($display_numeric_data) {
//Echo "line 284 - \$display_numeric_data is - $display_numeric_data ";
Echo "
";
include "./numeric_data.php";
}
else {Echo "Numeric data chosen not to show

";
};

//echo "numeric_data is - $display_numeric_data";

echo "
";

//include "./wood_data.php";


?>


END OF WOOD DATA REPORT






--=====================_5796747==.ALT--

Re: Help me dig out of a mini-nightmare. Some parameters

am 28.07.2010 11:16:37 von Richard Quadling

On 28 July 2010 06:13, Bill Mudry wrote:
> Along with suggestions from this group, I was able to transfer parameters
> across html pages so that
> a user could pick a wood species and the new page would faithfully report
> details on that wood.
> Later (with help from the group again) I was so glad to see that these pages
> were able to pick up
> JPEG scans of how some woods look like, one more important step forward for
> the project. When I then added a form for users to choose what extra data
> they wanted to see and it would recycle to
> the same page, the scan picture would disappear. A suggestion of adding a
> hidden field in the form
> even fixed that :-) . Things went swimmingly for a while.
>
> I don't know just what I did wrong but somewhere between trying to add some
> Javascript to create
> new pop ups (they even work now, too) for user choices for showing other
> photos, I messed up the page bad enough that it took a few days to even get
> everything showing up again. Well .... almost everything.
>
> It is able to pick up the choice of botanical name that a user chooses from
> a very large list of woods and display the text data for that one wood just
> fine again on another page. What I cannot seem to get back again is to show
> the wood scans for those woods for which I have scans (.... literally
> scanned on a scanner, btw, instead of a camera).
>
> I have temporarily hard coded a full path and file name for a typical wood
> that should have a picture
> to show .... and the scan shows up just great, proving that part of the
> logic is still intact, fine and working. The problem seems to be for some
> reason that I no longer understand in getting the name and partial path of
> the scan file to show up via the super-globals.
>
> Both the botanical name ('species_name') and the scan picture name
> ('picture_filename1')
> are stored in the table 'species'. The scans actually have a gallery folder
> as part of what is stored
> (eg. "gallery_a/ablies_alba, gallery_b/betula_nigra, and so on).
>
> I have tried using (parse_str($_SERVER['QUERY_STRING'], $qs). I have tried
> using $_GET that
> has worked well before ..... but to no avail. I did try experimenting quite
> a bit before finally and
> with some regret deciding I am past what I know on why NOW (remembering this
> used to work)
> I just cannot get the content from column picture_file1 to come across also.
> I keep saying it SHOULD
> work.... but it doesn't.
>
> With more and more functions being installed on this page, I will still put
> the whole page code,
> even though it will have sections that need no attention ... just to be on
> the cautious side. This seems
> so elementary and yet I cannot get it to work. (bear with so many commented
> statements .... stabs
> at getting this to work).
>
> Three steps forward ..... one step back ......
>
> Bill Mudry
>

Hello Bill,

My personal preference is to store the data in the $_SESSION. Once you
do that, each page really only has to provide your code with new data.
Once you are back at the server, any previously received data is in
the session. This will be available for all requests (css, images,
javascript, etc.) so you don't need to tack parameters onto the URL or
hidden .

So, for a popup making requests for an image will have access to the
$_SESSION exactly the same way (assuming the request is to a PHP
script which has to find the image, etc.)

--
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php