[thelist] passing a variable through a form using php

Joshua Hmielowski jhmielowski at comcast.net
Thu Sep 25 22:07:14 CDT 2003

what I am trying to achieve is to pass a variable ($value) to the same 
page that the form sits on "catalog.php"
<form action="catalog.php">
the form in which I am trying pass this var is a option list.  I have 
set the values to pass with the correct option.
the value does seem to get passed considering I can see it in the url 
I wrote a test script to catch and test the variable. I am using the 
!isset() and the empty() functions to test the var.
what I get is the var in NOT set.  (the !isset returns true)
any Ideas?

thanx for your time.


                           <form name="form1" method="get" 
												<!--the form action is to same page-->

			   <select name="select">
                               <option disabled value="">CATALOG 
                               <option name= "ceramic" value="<? echo 
$value="ceramic" ?>">ceramic tiles</option>
												<!--the $value is passed with the appropriate value-->

			<option name="stone" value="<? echo $value="stone" ?>">stone   
			<option name="hardware" value="<? echo $value="hardware" 
                               <option name="plumbing" value="<? echo 
$value="plumbing" ?>">plumbing</option>
                               <option name="accessories" value="<? echo 
$value="accessories" ?>">accessories</option>
                             <input type="submit" value="search 
database" >  



			function statements(){
					 if(!isset($value)) {                		 //tests to see if the var 
has been set
                					 echo "value is not set";
					elseif(empty($value)) {			//assumes it was set and tests to see if 
it has a value
                					echo "it is an empty value";
					 elseif($value == "ceramic"){		//if this value, echo this
						echo "the value passed is $value";
					elseif($value =="stone") {		 	//if this value, echo this
                		 			do {  ?>
                      				<img src="<?php echo 
$row_Recordset1['thumbpath']; ?>">
                      			<?php } while ($row_Recordset1 = 
					 else {						//if nothing else, do this.
						echo "the first two conditions were not met.";



More information about the thelist mailing list