2 Replies - 363 Views - Last Post: 22 March 2013 - 02:24 AM Rate Topic: -----

#1 poldz123  Icon User is offline

  • D.I.C Head

Reputation: 1
  • View blog
  • Posts: 52
  • Joined: 26-October 12

undifine function

Posted 21 March 2013 - 08:30 PM

What is the problem with this code?

I cant find out what it is

<?php

$action = $_POST['action'];

if($action == 'check_username'){
	
$u = $_POST['username'];
_check_username($u);

function _check_username($u){
	$un = arrays("rodolfo","Rodolfo","poldz123","rodolfo123","rodolfo@yahoo.com");
	if(in_array($u, $un)){
		echo"<span class = 'no'>{$u} is no available</span>";
		
	}else{
		echo"<span class='yes'{$u} is available</span>";
	}
	
}
}
?>


Is This A Good Question/Topic? 0
  • +

Replies To: undifine function

#2 Sho Ke  Icon User is offline

  • D.I.C Regular
  • member icon

Reputation: 110
  • View blog
  • Posts: 250
  • Joined: 13-October 11

Re: undifine function

Posted 21 March 2013 - 09:12 PM

On line 8 you're calling the function _check_username() when it doesn't exist. You create the function 2 lines down on line 10.
Was This Post Helpful? 2
  • +
  • -

#3 JackOfAllTrades  Icon User is offline

  • Saucy!
  • member icon

Reputation: 6075
  • View blog
  • Posts: 23,541
  • Joined: 23-August 08

Re: undifine function

Posted 22 March 2013 - 02:24 AM

In the future, don't post "questions" like this:

Quote

What is the problem with this code?

I cant find out what it is


Tell us EXACTLY what is wrong, as in what errors you're getting, how you expect the code to work vs. how it's actually working, etc.
Was This Post Helpful? 1
  • +
  • -

Page 1 of 1