Codice PHP:
<?
/////////////////////////////Name Your Form
$name_form = "Contact Form";
$Comp_Name = "10Tons";
$email_address = "talgi@email.it";
$home_url = "http://www.giovaniin.altervista.org/";
/////////////////Table and Font Set Up///////////
$table_width = "510";
$font_face = "Arial";
$size = "2";
////////////////////////Input 1(yes=1, no=0)
$add_input1 = "1";
$check_input1 = "1";
$input1_name = "Nome e Cognome";
////////////////////////Input 2(yes=1, no=0)
$add_input2 = "0";
$check_input2 = "0";
$input2_name = "Cognome";
/////////////////////////Input 5(yes=1, no=0)
$add_input5 = "0";
$check_input5 = "0";
$input5_name = "Input5";
////////Do you want radio Buttons(yes=1, no=0)
$radio = "0";
////////If yes Define Variables here///////////
$radio1 = "Web Site";
$radio2 = "Training";
$radio3 = "Help";
//////////////Do you want a select(yes=1, no=0)
$select = "0";
////////If yes Define Variables here///////////
$opt1 = "Design";
$opt2 = "Development";
$opt3 = "Banners";
$opt4 = "Logos";
$opt5 = "Question On Site";
$opt6 = "Help Please";
$opt7 = "Hosting";
$opt8 = "image/thanks.gif";
///////////////////Do you want a comment box(yes=1, no=0)?///////////////////////
$comment = "1";
///////////////////////////Tracking Number///////////////////////////
$unique = uniqid(1234567890);
$id = substr("$unique", 18);
////////////////////////////////Start the Form Building////////////////////////
if ($add_input1 == "1"){
$form_input1 = "
<tr>
<td colspan=\"2\"><font face=\"$font_face\" size=
\"$size\"><strong>$input1_name</strong></td></tr>
<tr><td colspan=\"2\" align=\"left\">
<input type=\"text\" size=\"35\" maxlength=\"256\" name=\"input1\">
</font></td>
</tr>";
}
if ($add_input2 == "1"){
$form_input2 = "
<tr>
<td align=\"right\"><font face=\"$font_face\" size=
\"$size\"><strong>$input2_name</strong></td>
<td align=\"left\">
<input type=\"text\" size=\"35\" maxlength=\"256\" name=\"input2\">
</font></td>
</tr>";
}
if ($add_input3 == "1"){
$form_input3 = "
<tr>
<td align=\"right\"><font face=\"$font_face\" size=
\"$size\"><strong>$input3_name</strong></td>
<td align=\"left\">
<input type=\"text\" size=\"35\" maxlength=\"256\" name=\"input3\">
</font></td>
</tr>";
}
if ($add_input4 == "1"){
$form_input4 = "
<tr>
<td align=\"right\"><font face=\"$font_face\" size=
\"$size\"><strong>$input4_name</strong></td>
<td align=\"left\">
<input type=\"text\" size=\"35\" maxlength=\"256\" name=\"input4\">
</font></td>
</tr>";
}
if ($add_input5 == "1"){
$form_input5 = "
<tr>
<td align=\"left\"><font face=\"$font_face\"size=
\"$size\"><strong>$input5_name</strong></td>
<td align=\"left\">
<input type=\"text\" size=\"35\" maxlength=\"256\" name=\"input5\">
</font></td>
</tr>";
}
//THis is your Radio Buttons//
if ($radio == "0" && $select == "0"){
$radio_head = "";
}else{
$radio_head = "
<tr>
<td align=\"right\"><font face=\"$font_face\" size=\"$size\"></td>
<td align=\"left\"><strong>Info requested on?</strong></font></td>
</tr>";
}
if ($radio == "1"){
$form_radio = "<br>
<td align=\"right\"><font face=\"$font_face\" size=\"$size\"></td>
<td align=\"left\"><input type=\"radio\" name=\"MessageType\" value=\"$radio1\" checked>
$radio1
<input type=\"radio\" name=\"MessageType\" value=\"$radio2\">
$radio2</font>
<input type=\"radio\" name=\"MessageType\" value=\"$radio2\">
$radio3</font></td>
</tr>";
}
if ($select == "1"){
$form_select = "
<td align=\"right\"><font face=\"$font_face\" size=\"$size\"></td>
<td align=\"left\">
<select name=\"Subject\" size=\"1\">
<option selected value=\"General\">General</option>
<option value=\"$opt1\">$opt1</option>
<option value=\"$opt2\">$opt2</option>
<option value=\"$opt3\">$opt3</option>
<option value=\"$opt4\">$opt4</option>
<option value=\"$opt5\">$opt5</option>
<option value=\"$opt6\">$opt6</option>
<option value=\"$opt7\">$opt7</option>
<option value=\"$opt7\">$opt7</option>
</select>
Other:
<input type=\"text\" size=\"10\" maxlength=\"256\" name=\"SubjectOther\"></td>
</tr>";
}
if ($comment == "1"){
$form_comment = "<td align=\"right\"><font face=\"$font_face\" size=\"$size\"></td>
<td align=\"left\"><strong>Inserire qui il testo del messaggio:</strong><br>
<textarea name=\"Comments\" rows=\"5\" cols=\"35\"></textarea>
</font></td>
</tr>";
}
///////////////////////////Form Build/////////////////////////////
$form_block = "
<FORM method=\"POST\" action=\"$PHP_SELF\">
<table width=\"$table_width\">
$form_input1
<tr>
<td colspan=\"2\" align=\"left\"><font face=\"$font_face\" size=\"$size\"><strong>Email</strong></td></tr>
<tr><td colspan=\"2\" align=\"left\">
<input type=\"text\" size=\"35\" maxlength=\"256\" name=\"email\">
</font></td>
</tr>
$form_email
$form_input2
$form_input3
$form_input4
$form_input5
$radio_head
$form_radio
$form_select
$form_comment
<tr>
</td></tr>
<tr><td colspan=\"2\">Affinché possiate essere rintracciati e presi in considerazione, vi preghiamo di compilare tutti i campi.</td></tr>
<td align=\"right\"></td><td align=\"left\">
<font face=\"$font_face\" size=\"$size\">
<INPUT type=\"hidden\" name=\"op\" value=\"ds\">
<INPUT type=\"submit\" value=\"Invia\">
<input type=\"reset\">
</td></tr></form>
</table>";
/////////////////////////////Begin Checking the form/////////////////////////////
if ($op != "ds") {
echo "$form_block";
} else if ($op == "ds") {
$send = "yes";
if ($check_input1=="1" && $input1=="") {
$input1_err = "
<font color=red>Il campo $input1_name è vuoto, riempilo.</font><br>
";
$send = "no";
}
if(!ereg("^([0-9,a-z,A-Z]+)([.,_]([0-9,a-z,A-Z]+))*[@]([0-9,a-z,A-Z]+)([.,_,-]([0-9,a-z,A-Z]+))*[
.]([0-9,a-z,A-Z]){2}([0-9,a-z,A-Z])?$",$email)) {
$email_err = "
<font color=red>Inserisci una Email valida, in modo da essere contattabile per un eventuale risposta.(Esempio:prova@email.it)!</font><br>
";
$send = "no";
}
if ($check_input2=="1" && $input2=="") {
$input2_err = "
<font color=red>Il campo $input2_name è vuoto, riempilo.</font><br>
";
$send = "no";
}
if ($check_input3=="1" && $input3=="") {
$input3_err = "
<font color=red>$input3_name Is blank.</font><br>
";
$send = "no";
}
if ($check_input4=="1" && $input4=="") {
$input4_err = "
<font color=red>$input4_name Is blank.</font><br>
";
$send = "no";
}
if ($check_input5=="1" && $input5== "") {
$input5_err = "
<font color=red>$input5_name Is blank.</font><br>
";
$send = "no";
}
$mail_body = "($email)\n";
$mail_body .= "Tracking Number = $id \n";
$mail_body .= "===============Personal Info===================== \n";
$mail_body .= "$input1_name = $input1 \n";
$mail_body .= "$input2_name = $input2 \n";
$mail_body .= "$input3_name = $input3 \n";
$mail_body .= "$input4_name = $input4 \n";
$mail_body .= "$input5_name = $input5 \n";
$mail_body .= "Comments\n";
$mail_body .= "------------\n";
$mail_body .= "$Comments\n";
$mail_body .= "Mailing List = $mailing_list, Contact Me = $ContactRequested\n";
$mail_body .= "===============Personal Info===================== \n";
$mail_body .= "ip is ($REMOTE_ADDR)";
if ($send == "yes") {
$headers = "From: \"$Name\" <$email>\n";
mail("$email_address", "$name_form", $mail_body, $headers);
$headers = "From: \"$Comp_Name\" <$Comp_email>\n";
echo "<center><img src=\"$logo\"></center><br>";
echo "<center><font face=\"Arial, Helvetica, sans-serif\" size=\"3\">Your Email Tracking Number is = ";
echo "(<b><font size=3 color=red>$Comp_Name-$id</font></b>)";
echo "</font><br>";
} else if ($send == "no") {
echo "<blockquote><blockquote>$input1_err";
echo "$email_err";
echo "$input2_err";
echo "$input3_err";
echo "$input4_err";
echo "$input5_err";
echo "Clicca <a href=\"javascript:history.back(1)\">qui</a> per tornare indietro e compilare i campi mancanti</blockquote></blockquote>";
}
}
?>
così dovrebbe essere impaginato come hai chiesto, solo che nn ho capito la parte del colore....