PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
Moderator: General Moderators
nitediver
Forum Contributor
Posts: 109 Joined: Tue Feb 24, 2009 9:05 am
Post
by nitediver » Fri Mar 26, 2010 9:17 am
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,
Last edited by
nitediver on Fri Mar 26, 2010 9:31 am, edited 1 time in total.
Alkis
Forum Commoner
Posts: 31 Joined: Fri Mar 26, 2010 8:41 am
Post
by Alkis » Fri Mar 26, 2010 9:23 am
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.
nitediver
Forum Contributor
Posts: 109 Joined: Tue Feb 24, 2009 9:05 am
Post
by nitediver » Fri Mar 26, 2010 9:38 am
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?
Alkis
Forum Commoner
Posts: 31 Joined: Fri Mar 26, 2010 8:41 am
Post
by Alkis » Fri Mar 26, 2010 10:01 am
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.
Alkis
Forum Commoner
Posts: 31 Joined: Fri Mar 26, 2010 8:41 am
Post
by Alkis » Fri Mar 26, 2010 10:19 am
yes something like that.
flying_circus
Forum Regular
Posts: 732 Joined: Wed Mar 05, 2008 10:23 pm
Location: Sunriver, OR
Post
by flying_circus » Fri Mar 26, 2010 10:40 am
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';
}
nitediver
Forum Contributor
Posts: 109 Joined: Tue Feb 24, 2009 9:05 am
Post
by nitediver » Sun Mar 28, 2010 9:28 am
Ok I'll try that, thanks.