Can I call the php function by clicking a button on the page? I just learned php and I don't know anything. Can I click a button on the php page to call the php function? The value of the parameter value entered in text on this page is used in the function. thank you! ------ Solution -------------------- ajax, but at the beginning, php does not need to be complicated, so as not to combat self-confidence ------ can php functions be called by clicking a button on the page?
I just learned php, and I don't know anything.
Can I click a button on the php page to call the php function? The value of the value-as-you-go parameter entered in text on this page is used in the function.
Thank you!
------ Solution --------------------
Ajax
------ Solution --------------------
Ajax, but it is not necessary to make complicated php learning at the beginning, so as not to crack down on self-confidence.
------ Solution --------------------
The client calls functions on the server. The best ajax method!
------ Solution --------------------
Discussion
Ajax, but it is not necessary to make complicated php learning at the beginning, so as not to crack down on self-confidence.
------ Solution --------------------
Add me QQ: 117434596
------ Solution --------------------
You should make your problem more concrete. maybe you don't need to use buttons to call the php function to solve your problem.
------ Solution --------------------
Simply put, use an onclick event to handle it! Is the value of the parameter input in text on this page used in the function? Do you want to get the content submitted by user input? It is as simple as $ _ GET, $ _ POST, and can be used based on your needs. There is also an onclick event for processing, for example:
PHP code
// After submission, you can call the corresponding function for processing. for example, you can submit the function check () {$ temp = $ _ GET ("component name") to this page. // The processing process is omitted}
------ Solution --------------------
Discussion
The function I want to implement is to click the button to send an email.
Then the content on the page is sent to this email function,
Function sendmail ($ to, $ from, $ subj, $ msg, $ Location, $ StartTime, $ EndTime)
PHP codefunction sendmeeting ()
{$ Conn = @ mysql_connect ("localhost", "root", "") ordie ("zookeeper Zookeeper"); if ($ conn) mysql_select_db ("business", $ conn); $ SQL = "select MailAdd from staff where MailAdd <> [email protected] '"; $ ResultMailAdd = mysql_query ($ SQL ); $ from = "[email protected]"; while ($ mailAdd = mysql_fetch_array ($ ResultMailAdd ));
{
Sendmail ($ mailAdd ['mailadd'], $ from, $ _ POST ["Subject"], $ _ POST ["Body"], $ _ POST ["Location"], $ _ POST ["StartTime"], $ _ POST ["EndTime"]);
} Mysql_close ($ conn );
}
This is the function for sending emails. this function calls the above function and uses the page and database content for parameters.
Can I do this without a button? Thank you for your advice.
------ Solution --------------------
Yes
You have used ajax technology.
------ Solution --------------------
Click the button to send mail?
Then you can write your mail function into a php file and click the button to call this php file. No onclick, ajax.
------ Solution --------------------
Discussion
The function I want to implement is to click the button to send an email.
Then the content on the page is sent to this email function,
Function sendmail ($ to, $ from, $ subj, $ msg, $ Location, $ StartTime, $ EndTime)
PHP codefunction sendmeeting ()
{$ Conn = @ mysql_connect ("localhost", "root", "") ordie ("zookeeper Zookeeper"); if ($ conn) mysql_select_db ("business", $ conn); $ SQL = "select MailAdd from staff where MailAdd <> [email protected] '"; $ ResultMailAdd = mysql_query ($ SQL ); $ from = "[email protected]"; while ($ mailAdd = mysql_fetch_array ($ ResultMailAdd ));
{
Sendmail ($ mailAdd ['mailadd'], $ from, $ _ POST ["Subject"], $ _ POST ["Body"], $ _ POST ["Location"], $ _ POST ["StartTime"], $ _ POST ["EndTime"]);
} Mysql_close ($ conn );
}
This is the function for sending emails. this function calls the above function and uses the page and database content for parameters.
Can I do this without a button? Thank you for your advice.
------ Solution --------------------
Discussion
In this case, the 15th floor does not cover any client server? I really don't understand.
------ Solution --------------------
It's too simple. php can certainly implement it. just write a form in html and submit an input: text (better with JS)