Forums

Merge Two Fields

Muneo 10 Jul, 2008
Hi,
I have two fields, the first one is hours and the second are minutes. The both is combo.
I want, before send email, merge these fields and the result will fill other field (maybe hidden)
Is it possible? How do it?
GreyHead 10 Jul, 2008
Hi Muneo,

Yes, you ca do this in the OnSubmit before box:
<?php
$_POST['hours'] = $_POST['hours'].":".$_POST['minutes'];
?>


Bob
Muneo 10 Jul, 2008
I tried but doesn't work.
Form HTML Field:

<label for="hours">Appointment</label>
<select name="hours" size="1" id="hours">
	<option value="8" selected="selected">8</option>
	<option value="9">9</option>
    <option value="10">10</option>
	<option value="11">11</option>
    <option value="12">12</option>
    <option value="13">13</option>
	<option value="14">14</option>
    <option value="15">15</option>
	<option value="16">16</option>
    <option value="17">17</option>
 	<option value="18">18</option>
</select>:<select name="minutes" size="1" id="minutes">
	<option value="00" selected="selected">00</option>
	<option value="15">15</option>
	<option value="30">30</option>
    <option value="45">45</option>
</select>


And "On Submit code - before sending email":


<?
php $_POST['hours'] = $_POST['hours'].":".$_POST['minutes'];
?>
GreyHead 11 Jul, 2008
Hi Muneo,

Apart from the broken <?php tag that looks OK - what shows up in the debug report?

Bob
Muneo 11 Jul, 2008
In my code, the php come together with <?...

_POST: Array ( [nome] => Jorge
[morada] => R. Lourenco
[localidade] => 454454
[distrito] => Viseu
[codpostal] => 2333-333
[datanasc] => 09/07/2008
[telefone] => 333-333-333
[telemovel] => 333-333-333
[email] => jorge.muneo@gmail.com
[datapret] => 16/07/2008
[horapret] => 3:00 PM
[dataalt] => 18/07/2008
[horaalt] => 11:00 AM
[motivo] => 343434343
[urgencia] => Sim ) 



Now, I am trying to merge datapret+horapret (the same idea).
The code for that (in On Submit code - before...) is:

<?php
$_POST['datapret'] = $_POST['datapret']." - ".$_POST['horapret'];
?>

I think that result was "...[datapret] => 16/07/2008 - 3:00 PM..."
But the code above is ignored...

PS: I solved the problem with hours using jquery... ...now, the hours(and minutes) come together in one field...
PS: But I still have problem to merge two fields
GreyHead 11 Jul, 2008
Hi Muneo,

I'm sorry, I no longer understand what you are trying to do and what is, or isn't, working.

Bob
Muneo 11 Jul, 2008
I am trying to merge two fields: datapret + horapret

<?php 
$_POST['datapret'] = $_POST['datapret']." - ".$_POST['horapret']; 
?>

but, the result was:

_POST: Array ( [nome] => Jorge 
[morada] => R. Lourenco 
[localidade] => 454454 
[distrito] => Viseu 
[codpostal] => 2333-333 
[datanasc] => 09/07/2008 
[telefone] => 333-333-333 
[telemovel] => 333-333-333 
[email] => jorge.muneo@gmail.com 
[datapret] => 16/07/2008 
[horapret] => 3:00 PM 
[dataalt] => 18/07/2008 
[horaalt] => 11:00 AM 
[motivo] => 343434343 
[urgencia] => Sim ) 

In other words, the php code doesn't merge...
Max_admin 11 Jul, 2008
Hi Muneo,

You can use the email template and write :

{hours}:{minutes}

Cheers

Max
Max
ChronoForms developer...
Did you try ChronoMyAdmin for managing your Joomla database tables ?
This topic is locked and no more replies can be posted.