Ok odio cuando la gente copia todo el codigo pero creo que no me queda otra opción.
El siguiente es el template html de un formulario, el hidden en question (casi al final de este codigo) recibe un codigo html a travez de Jquery.
Se que lo recibe bien lo veo con firebug, el input todavia es radio.
Código PHP:
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link rel="stylesheet" href="css/styles.css" type="text/css" media="screen" />
</head>
<body>
<form id="form_email" action="email_proccess.php" method="post">
<fieldset>
<legend>User Information</legend>
<div><p><label>Date:</label><?php echo date('D M d G:i:s Y');?></p></div>
<div><p><label>My Name:</label><input type="text" name="name" ></p></div>
<div><p><label>Section ID:</label><input type="text" name="sectionid" ></p></div>
<div><p><b>E-mail these results to:</b></p></div>
<div><p><label> </label>E-mail address:</p></div>
<div>
<p><label>Me:</label>
<input type="text" name="email-student">
<select name="formatstudent">
<option value="html">HTML</option>
<option value="plain">Text Plain</option>
</select>
</p>
</div>
<div>
<p><label>My instructor:</label>
<input type="text" name="email-instructor">
<select name="formatinstructor">
<option value="html">HTML</option>
<option value="plain">Text Plain</option>
</select>
</p>
</div>
<div>
<p><label>My TA:</label>
<input type="text" name="email-ta">
<select name="formatta">
<option value="html">HTML</option>
<option value="plain">Text Plain</option>
</select>
</p>
</div>
<div>
<p><label>Other:</label>
<input type="text" name="email-other">
<select name="formatother">
<option value="html">HTML</option>
<option value="plain">Text Plain</option>
</select>
</p>
</div>
<input type="submit" value="E-mail The Results" class="rightAlign">
</fieldset>
<input type="hidden" name="bodyInfo" id="bodyInfo">
<input type="hidden" name="questsInfo" id="questsInfo">
</form>
</body>
</html>
El script que recibe el post,
Código PHP:
<?php
include('lib/phpMailer/class.phpmailer.php');
include('lib/phpMailer/classValidationEmail.php');
$objEmail = new EmailModel();
foreach ($_POST as $item => $value) {
if (preg_match("/^email-/",$item) && $value!=''){
$objEmail->checkEmail($value, $_POST['format'.substr($item, 6)]);
}
}
//die();
$mail = new phpmailer();
$mail->PluginDir = "lib/phpMailer/";
$mail->Mailer = "smtp";
$mail->Host = "mail.uvcms.com";
$mail->SMTPAuth = true;
$mail->Username = "webuser";
$mail->Password = "webazx";
$mail->From = $_POST['email-student'];
$mail->FromName = 'Results of '.$_POST['name'].' Section '.$_POST['sectionid'];
$mail->Timeout=30;
if (count($objEmail->wrongEmails)) {
echo '<br />The following are not valid email:<br />';
foreach( $objEmail->wrongEmails as $value)
echo $value.'<br />';
unset($objEmail->wrongEmails);
}
$mail->Subject = 'Quiz Results';
//$mail->Body = $_POST['bodyInfo'].$_POST['questsInfo'];
$bodyContent = $_POST['bodyInfo'].$_POST['questsInfo'];
$mail->AltBody = "Mensaje de prueba mandado con phpmailer en formato solo texto";
$message = '<br />Message correctly sent to the following addresses:<br />';
$messageFlag = 1;
foreach( $objEmail->validEmails as $item => $value) {
$mail->AddAddress($value);
if ($objEmail->contentType[$item]=='plain') {
$bodyContent = strip_tags($bodyContent);
}
$mail->Body = $bodyContent;
$exito = $mail->Send();
if (!$exito) {
$objEmail->wrongEmails[count($objEmail->wrongEmails)] = $value;
}else {
if($messageFlag)
echo $message;
echo $value.'<br />';
$messageFlag = 0;
}
$mail->ClearAddresses();
}
if (count($objEmail->wrongEmails)) {
echo "<br />Problems sending email to:<br/>";
foreach($objEmail->wrongEmails as $value)
echo $value.'<br />';
}?>
Es en este script donde el radio cambia a type="text"
die(var_dump($_POST['questsInfo']));