Usamos cookies para medir audiência e melhorar sua experiência. Você pode aceitar ou recusar a qualquer momento. Veja sobre o iMasters.
Estou modificando um código de registro para que no cadastro o usuário decida se quer ou não receber newsletters.
{if $act == regvalidate}
<table width="75%" border="1" align="center" cellpadding="3" cellspacing="0" class="border">
<tr class="sectionheader">
<td> {#register#} </td>
</tr>
<tr>
<td>{#validation_message#}</td>
</tr>
</table> <form action="{$settings.dburl}/index.php?act=register&process" method="post">
<table width="75%" border="1" align="center" cellpadding="3" cellspacing="0" class="border">
<tr class="sectionheader">
<td colspan="2"> {#register#} </td>
</tr>
<tr>
<td width="50%">{#username#}:</td>
<td width="50%">
<input type="text" name="username" size="40" maxlength="25" />
</td>
</tr>
<tr>
<td width="50%">{#password#}:</td>
<td width="50%">
<input type="password" name="password" size="40" />
</td>
</tr>
<tr>
<td width="50%">{#confirm_pass#}:</td>
<td width="50%">
<input type="password" name="conf" size="40" />
</td>
</tr>
<tr>
<td width="50%">{#email#}:</td>
<td width="50%">
<input type="text" name="email" size="40" maxlength="50" />
</td>
</tr>
//Início: O Que Acrescentei
<tr>
<td width="50%">Receber Atualizações Semanais:</td>
<td width="50%">
<input type="radio" value="1" checked name="ativo"> Sim
<input type="radio" name="ativo" value="2">Não
</td>
</tr> <tr>
<td align="center" colspan="2"><input type="submit" value="{#register#}" /></td>
</tr>
</table>
</form>
{/if}
E na página de inserir dados no BD,
//The boring stuff. DB insert, send e-mail.
$db->Execute("INSERT INTO ".$dbPrefix."users (user_username, user_password, user_email, user_status, user_emailvalidation, ativo) VALUES ('".xhtml_convert($_POST['username'])."', '".md5($_POST['password'])."', '".xhtml_convert($_POST['email'])."', 2, '".$validation."','".$ativo."')");
$newID = $db->Insert_Id();
$emailmsg = str_replace('%DBNAME%', $settings[0]['dbname'], lang('validation_email'));
$emailmsg .= "\n\n";
$emailmsg .= $settings[0]['dburl'].'/index.php?act=register&validate&userid='.$newID.'&validation='.$validation;
pafiledb_mail($settings[0]['dbname'], $settings[0]['fromemail'], array(array('name' => $_POST['username'], 'address' => $_POST['email'])), str_replace('%DBNAME%', $settings[0]['dbname'], lang('validation_email_subject')), $emailmsg);
$smarty->assign('act', 'regvalidate');
}
Já tentei acrescentar
$ativo
$_POST['ativo']
xhtml_convert($_POST['ativo'])O valor adicionado na coluna ativo fica sempre 0 independente de qual opção marcar...
Coloquei a estrutura dele no phpmyadmin como:
Campo Tipo Collation Atributos Nulo Padrão Extra
ativo int(1) Não
Mas na realidade não sei cqual colocar e como isso interfere...
É urgente, quem puder me ajudar, agradeço!
Carregando comentários...