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

Bill Mudry <[email protected]>
Newsgroups gmane.comp.php.windows
Message-ID <[email protected]>
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

========================================================================
<code>


<!--------------------------------------------------------------------------------------

   File: displayspecies.php
   Date last revision: July 27, 2010
   Description: Displays all details of a chosen species.
         Called by: displaygenera2.php, alphpaspecies.php

------------------------------------------------------------------------------------->

  <?php

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

Echo "on line18 \$qs is - $qs<br />";

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

Echo "on line 21 \$picture_filename is - $picture_filename <br />";

//$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 <br />";



# 
////////////////////////////////////////////////////////////////////////////////////
#                                           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<br>\n";
         Echo MYSQL_ERROR();
         };
/*
         if ($row6){
         $z=extract($row6); //Echo MYSQL_ERROR();
         };
*/


?>


<html>
<!-----------------------------------------------------------------------------------------
                         START OF HEADER
------------------------------------------------------------------------------------->

<head>
<?PHP
         Echo "<title>Data on a specific chosen botanical species 
$species_name .</title>" ;
         //Echo "";


?>

         <Script type="text/javascript">
                 Function newWindow() (
                         window.open("show_photomicros.htm", "sub", 
height="300", width='200');
                 }
         </SCRIPT>

         <!---
         <style type='text/css'>webmessage.p {font-size: 7px; 
font-family:Verdana, Geneva,
                 sans-serif;}</style>
     -->

         </HEAD>

<!-----------------------------------------------------------------------------------------
                         END OF HEADER
------------------------------------------------------------------------------------->


<!-----------------------------------------------------------------------------------------
///////////////////////////////////////////////////////////////////////////////////////////
// 
//
//                                                 START OF 
BODY                                         //
// 
//
///////////////////////////////////////////////////////////////////////////////////////////
------------------------------------------------------------------------------------------>

         <BODY bgcolor='antiquewhite' border='1'>

<!-- 
-------------------------------------------------------------------------------------
                       START OF WEBMASTERS MESSAGE
------------------------------------------------------------------------------------------>

         <TABLE align='CENTER' cellpadding='10' 
bgcolor='antiquewhite' border='5' bordercolor='navy' width='800'>
         <TR>
                 <TD>

         <P align='left' class = 'webmessage.p'>
         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!
         </P>
         <P align='left' class='webmessage.p'>
         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.
         </P>
                 </TD>
     </TR>
         <TR>
                 <TD>
         <P align='left' class='webmessage.p'>
         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.
     </P>
                 <DL class='webmessage.p'>
                 <DT><B>General Information</B></DT>
             <DD>Basic information on wood any reader would want. 
Always present.
             </DD>
                 <DT><B>Woodworking Information</B></DT>
             <DD>Optional information on what a wood is like to use 
and work with.<BR />
                 Of interest for anyone who will work with a wood.
             </DD>
                 <DT><B>Numeric Test Information</B></DT>
             <DD>Optional information on lab test results.<BR />
                 Largely of interest to architects, engineers and 
researchers. Data is less common.
             </DD>
                 </DL>

         </P>

                 </TD>
     </TR>
     </TABLE>



<!-- 
--------------------------------------------------------------------------------------------------------------------
                                           END OF WEBMASTERS MESSAGE
------------------------------------------------------------------------------------------------------------------------->
     <BR>
         <HR>
<BR>



<?php

         echo "<h2 align='center'>Woody Species $species_name</h2>";

         echo "<H4 align='center'><strong>Data on a chosen woody 
species known under a chosen genus</strong></h4>";

//////////////////////////////////////////////////////////////////////////////////////////////////////
// 
Section to show scans
//////////////////////////////////////////////////////////////////////////////////////////////////////

Echo "<div align = 'center'>";

          //Echo "START OF PICTURE AREA<br><br>";


print_r($_GET);
  if($_GET["picture_filename1"] === "") echo "picture_filename1 is an 
empty string<br />\n";
  if($_GET["picture_filename1"] === false) echo "picture_filename1 is 
false<br />\n";
  if($_GET["picture_filename1"] === null) echo "picture_filename1 is 
null<br />\n";
  if(isset($_GET["picture_filename1"])) echo "picture_filename1 is 
set<br />\n";
  if(!empty($_GET["picture_filename1"])) echo "picture_filename1 is 
not empty<br />";
echo "<br />";







         //$picture_filename1 = $_GET["picture_filename1"];

          Echo "On line 185 \$picture_filename1 is - 
$picture_filename1<br><br>";


         //$picture_path = "./wood_scans/$picture_filename1";


         //$picture_path = "./wood_scans/gallery_a/acacia_arabicababul.jpg";

         $picture_path = "";


          //Echo "\$picture_path is - $picture_path<br><br>";


         //Echo " Before if, \$picture_path is - $picture_path<br /><br /";

         If ($picture_path)
                 {echo "<img src = $picture_path><br /><br />";}
         else echo "No picture<br /><br />";

         //(Echo "\$picture_path is - $picture_path<br /><br />;


  // Echo "<br />END OF PICTURE AREA<br /><br />";

Echo "</div>";

?>

<!--------------------------------------------------------------------------------------------------------
                                 Start of Pop-up windows for 
photomicros, more scans and UV photos
--------------------------------------------------------------------------------------------------------->

<TABLE align='center' cellpadding='10', Cellspacing='20' border =0>
<TR>
         <TD valign='top'>
                 <FORM name='winform'>
                         <INPUT type="button" 
value="Photomicrographs" onClick="NewWin=window.open('show_photomicros.htm',
                         'toolbar=no, status=no, width=200, 
height=150, resize=yes'); ">
                         <BR />
                         <P><INPUT TYPE="button" VALUE="Close Window" 
onClick="NewWin.close();"></P>
                 </FORM>
         </TD>
         <TD valign='top'>
                 <FORM name='winform'>
                         <INPUT type="button" value="More Photos" 
onClick="NewWin=window.open('show_more_photos.htm',
                         'toolbar=no, status=no, width=200, 
height=150, resize=yes'); ">
                         <BR />
                         <P><INPUT TYPE="button" VALUE="Close Window" 
onClick="NewWin.close();"></P>
                 </FORM>

         </TD>
         <TD valign='top'>
                 <FORM name='winform'>
                         <INPUT type="button" value="U.V. 
Fluorescence" onClick="NewWin=window.open('show_uv_photos.htm',
                         'toolbar=no, status=no, width=200, 
height=150, resize=yes'); ">
                         <BR />
                         <P><INPUT TYPE="button" VALUE="Close Window" 
onClick="NewWin.close();"></P>
                 </FORM>

         </TD>

</TR
 ></TABLE>

<!--------------------------------------------------------------------------------------------------------
                                 End of Pop-up windows for 
photomicros, more scans and UV photos
--------------------------------------------------------------------------------------------------------->
<BR /><BR />

<?php


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


         Echo "<table align='CENTER' cellpadding='10' bgcolor='white' 
border='2' bordercolor='saddlebrown' width='800'>";
         Echo "<tr>";
         Echo    "<td colspan=2><h2 align='center'>General Data for 
Species $species_name</h2></td>";
         Echo "</tr>";
         Echo "<tr>";
         Echo    "<td>Authority - $authorities_species</td>";
         Echo    "<td>Varieties, cultivars, Hybrids, Subspecies - 
<br>\n $varieties</td>";
         Echo "</tr>";
         Echo "<tr>";
         Echo    "<td>Common Names - $species_commonname</td>";
         Echo    "<td>Synonyms - $syn_species</td>";
         Echo "</tr>";
         Echo "<tr>";
         Echo    "<td>Gymnosperm or Angiosperm? $gymno_angio</td>";
         Echo    "<td>Commercial wood? - $commercial_wood </td>";
         Echo "</tr>";
         Echo "<tr>";
         Echo    "<td>Uses - $species_uses</td>";
         Echo    "<td>Durability -  $durability</td>";
         Echo "</tr>";
         Echo "<tr>";
         Echo    "<td>Plant forms - $species_life_form</td>";
         Echo    "<td>Typical sizes of plant - $species_lifeform_size</td>";
         Echo "</tr>";
         Echo "<tr>";
         Echo    "<td>Seasoning - $seasoning</td>";
         Echo    "<td>Stability - . $stability</td>";
         Echo "</tr>";
         Echo "<tr>";
         Echo    "<td colspan=2>General Description - 
$species_description</td>";
         Echo "</tr>";
         Echo "<tr>";
         Echo    "<td colspan=2>Typical Defects - $defects</td>";
         Echo "</tr>";
         Echo "<tr>";
         Echo    "<td colspan=2>Toxicity - $toxicity</td>";
         Echo "</tr>";
         Echo "<tr>";
         Echo    "<td colspan=2>World Distribution - $location</td>";
         Echo "</tr>";
         Echo "<tr>";
         Echo    "<td colspan=2>Comments - $comments</td>";
         Echo "</tr>";



         Echo  "</td></tr></table><br><br>\n"; //Close off data table;

    Echo "<hr width='400'><br />";



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

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

?>


<div align="center">
<H3 align="center">Choose if you wish to also view Woodworking or 
Numeric Data</H3>
  <FORM name="choose_data"  method="GET" action="<?php echo 
$_SERVER['PHP_SELF']; ?>" >

<TABLE align="center" border=0 bgcolor='ivory' cellpadding=10>
     <TR>
         <TD >
             <B>Show Woodworking Data  </B>
             <Input type='checkbox' name='show_woodworking' />
         </TD>
         <TD >
             <B>Show Numeric Test Data  </B>
             <Input type='checkbox' name='show_numeric' />
         </TD>
     </TR>
     <TR>
         <TD colspan=2 align="center">
       <?PHP
         echo "<input type='hidden' name='species_name' 
value='{$species_name}' />";
       ?>
             <Input type='submit' value='Choose Data to View' />
         </TD>
     </TR>
</TABLE>
</FORM>



<?PHP

////////////////////////////////////////////////////////
//    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 "<br />";
//Echo "line 256 \$display_numeric_data is - $display_numeric_data ";
//Echo "<br />";

//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<br />";
//Echo "line 270 - \$display_numeric_data is - $display_numeric_data<br />";

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

                 };

//  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 "<br />";
         include "./numeric_data.php";
         }
         else {Echo "Numeric data chosen not to show<br /><br />";
};

//echo "numeric_data is - $display_numeric_data";

echo "<br />";

//include "./wood_data.php";


?>


<H3 align="center" >END OF WOOD DATA REPORT</H3>


</BODY>
</HTML>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.