Forums

Transferring variable from HTML for to PHP

Harpist 15 May, 2009
I have just begun working with the ChronoForms and it looks like a great tool. I have never done any any HTML programming (only PHP) and have a question about mixing the two languages.

I have PHP code that I have placed into the "On Submit code - before sending email:" form code box and I have created a simple form that gets placed as HTML code into the "Form HTML box" (I added the HTML code at the end of this post).

Having never done HTML coding, I have no clue as to how I transfer the text that the user puts into the input box into the PHP code. Any assistance would be welcome.

Good Roads

Harpist

HTML code:

<div class="form_item">
<div class="form_element cf_textbox">
<label class="cf_label" style="width: 100px;">Stock symbol</label>
<input class="cf_inputbox required validate-alphanum" maxlength="50" size="20" title="" id="text_0" name="text_0" type="text" />

</div>
<div class="cfclear"> </div>
</div>

<div class="form_item">
<div class="form_element cf_button">
<input value="Submit" name="button_1" type="submit" />
</div>
<div class="cfclear"> </div>
GreyHead 15 May, 2009
HI harpist,

There's a vital piece missing here - you haven't said what you are trying to achieve? What do you want to do with the results?

Bob
Harpist 15 May, 2009
Hi GreyHead,

I wish to take the text entered by the user into the input text box and transfer it into a PHP program (when teh Submit button his pressed). The PHP routine will then pull info from a database and display this information (using a simple echo command) in the module area under the the "Submit" button.

Is this the info you are looking for?

Good Roads

Harpist
Max_admin 18 May, 2009
Hi Harpist,

You should add your code to the onSubmit AFTER email box!

if your PHP is fine then it should display your result after the form is submitted!

you may use variables like $_POST['field_name'] to get the field value in the PHP code!

Cheers
Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
Harpist 18 May, 2009

Hi Harpist,

You should add your code to the onSubmit AFTER email box!

if your PHP is fine then it should display your result after the form is submitted!

you may use variables like $_POST['field_name'] to get the field value in the PHP code!

Cheers
Max



Max,

Thanks for the assistance. I have gotten $_POST to work and can transfer data to the PHP code.

However, the echo from PHP is not going to the same module area where the form resides - but to the main page instead. Is there a way of directing this (either in HTML or PHP).

Again, thanks for your assistance.

Good Roads

Harpist
Max_admin 19 May, 2009
Hi Harpist,

Please show me a screenshot for this so I make sure we are on the same page!

Cheers
Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
Harpist 22 May, 2009
admin,

Attached is the screen dump. The form on the right (Stock Symbol) is the ChronoForm. The text in the center (Starting date, ending date, buy/hold return, etc...) is the echo from the PHP code). I would like to have the form and the PHP echo in the same same module.

Thanks for your assistance.

Good Roads

Harpist
GreyHead 23 May, 2009
Hi harpist,

As far as I know ChronoForms doesn't support showing form results in a module - maybe in a future release.

In this case is there any reason why you need to use a module at all - can you build the PHP results into the ChronoForms output.

Bob
Max_admin 24 May, 2009
Hi harpist,

As Bob said, its not possible now but will add it to RC5.1

Regards,
Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
Harpist 26 May, 2009

Hi harpist,

As far as I know ChronoForms doesn't support showing form results in a module - maybe in a future release.

In this case is there any reason why you need to use a module at all - can you build the PHP results into the ChronoForms output.

Bob



Bob,

Thanks for the info. I can certainly include the PHP code into the HTML but was hoping to keep it separate to keep it a bit cleaner. I have now integrated the two codes and it works fine.

Thanks for your help!

Good Roads

Harpist
This topic is locked and no more replies can be posted.