I use the custom mailform provided by cmsimple wiki (see original code below).
Some problems / requests :<TEXTAREA style="WIDTH: 101.34%; HEIGHT: 275px" rows=14>
#CMSimple // Custom mailform for CMSimple version 2.4
$reciever='somebody@somedomain.dk';
$message="\n\nThis is an automatic generated mail.\n\nSincerely\nThe Webmaster";
$recievermessage="\n\nThis is an automatic generated mail.";
// Define your field names and add extra lines for select options
// Use _ for spaces
$fields=array('name','adress','zip','Define_your_own','email');
$select['adress']=array('none','elephant','cow','tiger');
$tx['mailform']['recieptnotsend']="Could not send reciept.";
// DO NOT CHANGE CODE BELOW!
function mtr($tk){if (is_array($GLOBALS['select'][$tk]))$t=select($tk); else $t='<input type="text" class="text" name="'.$tk.'" value="'.$GLOBALS[$tk].'">';
return '<tr><td>* '.ucfirst(preg_replace('/\_/',' ',$tk)).'</td><td>'.$t.'</td></tr>';}
function select($tk){$t='';foreach($GLOBALS['select'][$tk] as $i){$t.='<option value="'.$i.'"';
if($GLOBALS[$tk]==$i)$t.=' selected';
$t.='>'.$i.'</option>';} return '<select class="text" name="'.$tk.'">'.$t.'</select>';}
$t='';$mailbody='';
if($action=='send'){foreach($fields as $i){initvar($i);if($GLOBALS[$i]=='')$e.='<li>You need to write '.$i;else $mailbody.=$i.': '.$GLOBALS[$i]."\n";}if(!(eregi("^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[_a-z0-9-]+(\.[_a-z0-9-]+)*(\.([a-z]{2,4}))+$",$email)))$e.='<li>'.$tx['error']['mustwritemail'].'.';else if($e==''){initvar('txtarea');$mailbody.=$txtarea;if(!(@mail($reciever,'Mailform from '.sv('SERVER_NAME'),$mailbody.$recievermessage,"From: ".$email."\r\n"."X-Remote: ".sv('REMOTE_ADDR')."\r\n")))$e.=tag('li').$tx['mailform']['notsend'];else {$t=tag('p').$tx['mailform']['send'].tag('/p');if(!(@mail($email,'Copy of mailform from '.sv('SERVER_NAME'),$mailbody.$message,"From: ".$reciever."\r\n"."X-Remote: ".sv('REMOTE_ADDR')."\r\n")))$e.='<li>'.$tx['mailform']['recieptnotsend'];}}}if($t==''||$e!=''){
$t='<form action="'.$sn.'" method="post"><input type="hidden" name="selected" value="'.$u[$s].'"><input type="hidden" name="action" value="send"><table cellpadding="5" cellspacing="0" border="0">';
foreach($fields as $field)$t.=mtr($field);
$t.='<tr><td colspan="2">Message:<br><t'.'extarea rows="6" cols="40" name="t'.'xtarea"></t'.'extarea></td></tr>';
$t.='</table><p><input type="submit" class="submit" value="'.$tx['mailform']['sendbutton'].'"></p></form>'; }
$output=preg_replace('/<textarea.*textarea>/is',$t,$c[$s]);#
</TEXTAREA>
1/ With IE the form keeps too small, whatever the “cols” value I specify.
This is curious because the with Firefox everything is OK : the form gets larger when the cols value is higher...
2/ How to add a captcha to this form ?
3/ By default all the fields are required. How to change this ?
Thanks in advance for your help.
And sorry for my poor english...
François - France