Linking a function?

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

Post Reply
nitediver
Forum Contributor
Posts: 109
Joined: Tue Feb 24, 2009 9:05 am

Linking a function?

Post 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,
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

Re: Linking a function?

Post 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.
nitediver
Forum Contributor
Posts: 109
Joined: Tue Feb 24, 2009 9:05 am

Re: Linking a function?

Post 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?
Alkis
Forum Commoner
Posts: 31
Joined: Fri Mar 26, 2010 8:41 am

Re: Linking a function?

Post 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.
nitediver
Forum Contributor
Posts: 109
Joined: Tue Feb 24, 2009 9:05 am

Re: Linking a function?

Post by nitediver »

Is this what you mean?

Code: Select all

 
action=' " " '>
 
Alkis
Forum Commoner
Posts: 31
Joined: Fri Mar 26, 2010 8:41 am

Re: Linking a function?

Post by Alkis »

yes something like that.
User avatar
flying_circus
Forum Regular
Posts: 732
Joined: Wed Mar 05, 2008 10:23 pm
Location: Sunriver, OR

Re: Linking a function?

Post 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';
}
nitediver
Forum Contributor
Posts: 109
Joined: Tue Feb 24, 2009 9:05 am

Re: Linking a function?

Post by nitediver »

Ok I'll try that, thanks.
Post Reply