Can I insert executable PHP code into Joomla custom HTML module?

AndreaNobili picture AndreaNobili · Oct 9, 2013 · Viewed 11k times · Source

if you open this Joomla website you can easy understand what I have to do: http://lnx.erusma.org

As you can see at the bottom of the page there is a Custome HTML Joomla module named Get in touch

This custom HTML module contains this simple HTML code that show an e-mail form:

<form>
    <input id="name" title="name" type="text" placeholder="Your name" size="23" style="width:94%" />
    <input id="email" title="email" type="text" placeholder="Your email" size="23" style="width:94%" /> <br />
    <input id="subject" title="subject" type="text" placeholder="Subject" size="51" style="width:94%" /><br />
    <textarea id="message" cols="33" style="width:94%" placeholder="Message"></textarea>
    <a style="display:inline-block;background:#fff;border: 1px solid #E7E7E7;border-bottom: 2px solid #93B62A;padding:8px 12px;" href="#" style="float: left;">Submit</a>
</form>

I have inserted this HTML code by the JCE Joomla Text Editor.

Now I want to do the following thing: I have to attach to this form a php script that sends an email to a certain address (sending the name of the sender, the e-mail of the senter, the subject o the message and the text of the message)

Can I put this executable PHP script into the JCE Joomla Text Editor? It seems to me that have some problem to do it but I don't know if am I missing something.

Tnx

Andrea

Answer

A. Zalonis picture A. Zalonis · Oct 9, 2013

You can use an module to do your job and not a html form via JCE Joomla Text Editor.

But if you want keep like that then you must replce <form> with below code

<form action='index.php?option=com_GetInTouch' method="get">

and after that you must develop your own custom joomla component named GetInTouch . Read this artiche about how can create custome component for joomla 2.5 http://docs.joomla.org/J2.5:Developing_a_MVC_Component/Developing_a_Basic_Component