Phpcms v9 Form Implementation question and answer advisory function

Source: Internet
Author: User

This article turns from others

PHPCMS V9 Message Board plug-in can be installed message board, do questions and answers, so there are a lot of things need to modify, but also some people found that Phpcms V9 has a Form Wizard function, only message, can not reply, today imitation Station NET: Xinyuan Network Studio to tell you how to use Phpcms The v9 comes with a Form wizard that enables this functionality:
First step create a new Form Wizard, table name customization

The second step is to build the appropriate fields according to your needs.

This is the front desk.

After the foreground submits the data, the background view shows the effect is this

Step three This is also the most critical step, now start to modify the source program

Open File phpcms/modules/formguide/templates/formguide_info_view.tpl.php below line 28th add the following:<tr><td> Back &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; answer:</td><td>< TextArea id="Answer"cols=" the"Rows="Ten"><?php echo $answer;?></textarea></td></tr><tr><td>&nbsp;</td> <td><input id="Tijiaohuida"Type="Button"Value="Submit an Answer"/></td></tr>the above variable $answer what's going on, just keep looking down. Add the following below line 30th:<script type="Text/javascript">$ (document). Ready (function () {varCanshustr=Window.location.search;varPos=canshustr.indexof ("&did");varPosend=canshustr.indexof ("&", pos+4);varDid_c=canshustr.substring (pos+5, posend);varAnswer_c="";$("#tijiaohuida"). Click (function () {Answer_c= $("#answer"). Val (); $.post ('Index.php?m=formguide&c=formguide_info&a=public_answer', {did:did_c,answer:answer_c}, function (JSON) {if(json==1) {alert ("Answer Success");}});});});</script>then open the file Phpcms/modules/formguide/formguide_info.php, add the following code in line 56: $answer= $info ['Answer']; At the end, add a method with the following code.  Publicfunction Public_answer () {$did= $_post[' did']; $answer= $_post['Answer']; $re= $ This->db->query ("Update kc_form_online_ask set answer= '". $answer."' , mark= ' has answered ' where dataid=". $did); echo $re;}


And then add two fields to the table in your database. Mark and Answer,mark are used to mark whether the problem has been answered, answer is used to store the answer
After the modification, in the background to see the submission of the effect of the message is this

After the answer is submitted, the style is adjusted, and then the foreground calls the two fields.
It is important to note that update kc_form_online_ask set answer= ' ". $answer." ', mark= ' has answered ' where dataid= '. $did the table name here is to be changed to your own table, Many friends because this can not be successful, and can not find the reason, here I remind you. I hope we can help you.
This article by The Imitation Station network original, if need reprint please bring the link http://www.upxinyuan.com/wangzhanjiaocheng/120_1.html

Phpcms v9 Form Implementation question and answer advisory function

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.