CMSimple <--> MySQL Database Connection

originated from the CMSimple Forum

An extensive explanation of this method can be found at Personalized Reply Page. It just misses the CMSimple-MySQL link. Otherwise, it uses the same method.

Project:

Call an application form which writes its data to a MySQL database. A reply page should be opened up in CMSimple which says “Thank you” and shows all the data once more, the applicant has just entered.

Solution:

Call a form page via the geturl() script. The form is introduced with:

<form name="Formular" action="./?Your_Application" method="POST">

“Your Application” is a hidden page which has to be generated. It is empty except for the CMSimple script to hide (#CMSimple hide#). In order to process the query just one line of code has to be added to the template.htm file.

<?=editmenu()?>
<?=content()?>
<?php if($u[$s]=='Your_Application'){include($pth['folder']['base'].'/handover.php');} ?>
<?=submenu()?>

Where you put the CMSimple content() function you just add this line of code, too. It makes sure that the call for “Your Application”, which is done by the form, hands over the data (or variables) to the “handover.php” file which does all the job - writing the data to the MySQL database and giving back the data to the hidden page (“Your_Application”). This hidden page finally turns up for the viewer. That's all. No other changes have to bemade.

You can place additional form pages and do queries, as well, by just adding more lines to the content.htm file. So you could add login procedures, questionaries, database queries - which get their own hidden page and their own single lines of code in the template.


~~DISCUSSION~~

tips_and_tricks/cmsimple_and_mysql.txt · Last modified: 2018/04/05 14:48 (external edit)
Webdesign: NMuD chimeric.de = chi`s home Creative Commons License Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0