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?

remove 's' from line 7
it should look like below

$error_array=array();

Also put a closing brace '}' on line no 47

commented: useful +5

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>

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>

Thanks a lot.

<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.

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.

<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.

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

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.