0

The following id my php code

<html>
 <head>
  Checking !
 </head>
<body>
 <?php
  $errors_array=array();
  if(isset($_REQUEST["welcome_already_seen"])){
    check_data();
    if(count($error_array)!=0){
      show_error();
      show_welcum();
     }
    else{
     handle();
     }
}
else {
    show_welcum();
}
   function show_welcum(){
   echo "<form method='post'>";
   echo "What's your ice cream flavour?";
   echo "<br>";
   echo "<input name='flavor' type='text'>";
   echo "<br>";
   echo "<input type='submit' value='send'>";
   echo "<br>";
   echo "<input type='hidden' name='welcum'>";
   echo "</form>";
  }
 function check_data(){
  global $error_array;
  if($_REQUEST["flavour"]==""){
   echo "<font color='red'> Please enter a value </font>";
 }
}
function show_error(){
 global $error_array;
 foreach($error_array as $err){
 echo $err,"<br>";
}
}
function handle(){
echo "your favourite ice cream flavour is ";
echo $_REQUEST["flavour"];
?>
</body>
</html>

but when I run it on the browser , it shows a blank screen, why?

Edited by Ezzaral: Added code tags. Please use them to format any code that you post.

3
Contributors
9
Replies
10
Views
6 Years
Discussion Span
Last Post by urtrivedi
0

Thanks that did work.can you please help me with this code, what is the possible error ,i f=get a blank screen in my browser .
<html>
<head>
Creating objects
</head>
<body>
<?php
class Objects{
var $name;
function set_name($na){
this->$name= $na;
}
function get_name(){
return this->$name;
}
}
$ob=new Objects;
$ob->set_name("ila");
echo "the name of greatest person alive is ",$ob->get_name();
?>
</body>
</html>

1

Make sure you write $this->name and NOT $this->$name.

<html>
<head>
Creating objects
</head>
<body>
<?php
class Objects
{
	var $name;

	function set_name($na)
	{
		$this->name= $na;
	}
	
	function get_name()
	{
		return $this->name;
	}
}

$ob=new Objects;
$ob->set_name("ila");
echo "the name of greatest person alive is ",$ob->get_name();

?>
</body>
</html>
0

<html>
<head>
</h1>Overloading tym!</h1>
</head>
<body>
<?php
class demo{
var $name;
var $msg;
function set_msg($data, $m){
$this->name=$data;
$this->msg=$m;
}
function set_name($data){
$this->name=$data;
}
function speak(){
echo $this->name,"hi!",$this->msg,"...","<br>";
}
function __call($method,$argument){
if ($method==set_msg){
if(count(argument)==1){
$this->name=argument[0];
}
if(count(argument)==2){
$this->name=argument[0];
$this->msg=argument[1];
}
}
}
}
$d=new demo;
$d->set_msg("ila","hello");
echo $d->speak();
?>
</body>
</html>
Kindly tell error in this code.

0
if(count($argument)==1)
			{
				$this->name=$argument[0];
			}
			if(count($argument)==2)
			{
				$this->name=$argument[0];
				$this->msg=$argument[1];
			}

Here you have not written $ sign before argument. In my previous post I suggest about position of dollar sign. So Here this->name is different then argument, so both will start with dollar sign.

Edited by urtrivedi: n/a

0

<html>
<head>
<h3> yups working with static property</h3>
</head>
<body>
<?php
class demo{
static $data;
static function demoagain($name){
self::$data=$name;
echo "so the value is", self::$data,"<br>";
self::$data++;
echo "the new value is", self::$data,"<br">;
}
}
demo::demoagain(13);
?>
</body>
</html>
please tell the error in this code.

0

Download php designer 2007 for free, its php editor that will help you to find syntax errors.

Edited by urtrivedi: n/a

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.