Re: Condition for Adding data (Still Having Problems)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Guys, I though maybe I can be more specific so you can see the problem I havin, The idea of having this code on my pgae was to execute a decision from a form input so that once a value has been choosen by a user a page unique to what he/she choose appears

So my Page looks soemthing like this

<?php
	$food=""; //Variable that will will determine which page to load)
	if($food=="Milk")
		{
		$pgload="dairy/dairy.php";
		}
		if ($food=="eggs")
			{
				$pgload=poultry/poultry.php;
			}
			if ($sector=="ham")
				{
					$pgload=both/swine.php;
				}
?>
<form name="appForm" method="post" action=.$pgload.>
				// the variable $pgload will place the page to be loaded
<select name="sector">
         <option value="Milk">Milk Products</option>
         <option value="Eggs">Egg Products</option>
         <option value="Ham">BreakFast</option>
       </select>
</form>

<

use this code and it should work:


<?php
	$pgload='';	// so that nobody can do cramp if register_globals is on
	switch($food)	// see http://www.php.net/switch
	{
		case 'milk':
			$pgload="milk.php";
		break;
		case 'egg':
			$pgload="egg.php";
		break;
		case 'ham':
			$pgload="ham.php";
		break;
	}
	echo  '<form name="appForm" method="post" action='.$pgload.'">';
?>

hope this helps (hth) .ma

e: grillen@abendstille.at
w: http://www.abendstille.at

# life would be easier if i knew the source code

Am Dienstag, 22.07.03 um 14:34 Uhr schrieb gatimu:

Hi
I need help!, I am quite new to php and I am trying to create a condition that will load a specific page after a form has been submitted to enter data in my database, I have tried using this code (I created it) but it wont work, all I get is a messege on the browser that says "the page address incorrect"


Here is how i have scripted the code
<?php
	$food="";
	if($food=="milk")
		{
		$pgload="milk.php";
		}
		if ($food=="eggs")
			{
				$pgload="egg.php;
			}
			if ($food=="ham")
				{
					$pgload="ham.php";
				}
echo  "<form name=appForm method=post action=.$pgload.>"
?>

any ideas on how i can go around this problem?

Gatimu


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






-- Using M2, Opera's revolutionary e-mail client: http://www.opera.com/m2/


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


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux