Page 1 of 1

Linking a function?

Posted: Fri Mar 26, 2010 9:17 am
by nitediver
Is it posible to link one function to another like this,

action=\" /*Here*/ \"

In these code, I want to link function one to function two,

Code: Select all

 
function one(){
$login_act = "login_act.php";
echo ("
<form name=\"login\" method=\"post\" action=\" /*Here*/ \">
username <input name=\"username\" type=\"text\" style=\"width: 100px;\">
password <input name=\"password\" type=\"password\" style=\"width: 100px;\">
<input name=\"login\" value=\"submit\" type=\"submit\">
</form>");
}
 
//another function
function two(){
...
...
...
}
 
thanks,

Re: Linking a function?

Posted: Fri Mar 26, 2010 9:23 am
by Alkis
You mean having a function as an alias to another? I don't thing this can be done. But in your example you can call function one() inside function two().

If this is not what you meant, let me know.

Re: Linking a function?

Posted: Fri Mar 26, 2010 9:38 am
by nitediver
Yes, I want to call one function inside another, I want to put that inside action=" ".

But since I use escape \\, that's seems doesn't work, is it still posible?

Re: Linking a function?

Posted: Fri Mar 26, 2010 10:01 am
by Alkis
Remove the escapes, and in place use single quotes instead of double ones, or use single quotes outside and double quotes on fields properties. That way you don't need escaping.

Re: Linking a function?

Posted: Fri Mar 26, 2010 10:14 am
by nitediver
Is this what you mean?

Code: Select all

 
action=' " " '>
 

Re: Linking a function?

Posted: Fri Mar 26, 2010 10:19 am
by Alkis
yes something like that.

Re: Linking a function?

Posted: Fri Mar 26, 2010 10:40 am
by flying_circus
There are a couple of ways.

Code: Select all

function one(){
$login_act = two();
 
echo ("
<form name=\"login\" method=\"post\" action=\" {$login_act} \">
username <input name=\"username\" type=\"text\" style=\"width: 100px;\">
password <input name=\"password\" type=\"password\" style=\"width: 100px;\">
<input name=\"login\" value=\"submit\" type=\"submit\">
</form>");
}
 
//another function
function two(){
...
...
...
return 'login_act.php';
}

Code: Select all

function one(){
echo ("
<form name=\"login\" method=\"post\" action=\"" . two() . "\">
username <input name=\"username\" type=\"text\" style=\"width: 100px;\">
password <input name=\"password\" type=\"password\" style=\"width: 100px;\">
<input name=\"login\" value=\"submit\" type=\"submit\">
</form>");
}
 
//another function
function two(){
...
...
...
return 'login_act.php';
}

Re: Linking a function?

Posted: Sun Mar 28, 2010 9:28 am
by nitediver
Ok I'll try that, thanks.