Varför fungerar inte min css mall i mitt formulär?

Avdelningen för webbrelaterad programmering och grafisk design.
Skriv svar
Användarvisningsbild
forcevision
Inlägg: 418
Blev medlem: 2007-06-17 11:21:44
Ort: Göteborg

Varför fungerar inte min css mall i mitt formulär?

Inlägg av forcevision » 2007-09-10 20:51:05

Hejsan !

Jag har laddat ner detta formulär som är i koden under. Men jag har lagt alla css koder i min css mall men nu fungerar dom inte. Är det någon som ser varför dom inte fungerar ?

php dokumentet:
[php]
<?php
error_reporting(7);
// This will show in the <title></title> and the form name
$websitename="Formulär";

// Allowed file types. Please remember to keep the format of this array, add the file extensions you want WITHOUT the dot. Please also be aware that certain file types may cause harm to your website and/or server.
$allowtypes=array("zip", "rar", "txt", "doc", "jpg", "png", "gif","odt","xml");

// What's your email address? Seperate email addresses with commas for multiple email addresses.
$myemail="e-mail";

// What priority should the script send the mail? 1 (Highest), 2 (High), 3 (Normal), 4 (Low), 5 (Lowest).
$priority="1";

// Should we allow visitors to attach files? How Many? 0 = Do not allow attachments, 1 = allow only 1 file to be attached, 2 = allow two files etc.
$allowattach="0";

// Maximum file size for attachments in KB NOT Bytes for simplicity. MAKE SURE your php.ini can handel it, post_max_size, upload_max_filesize, file_uploads, max_execution_time!
// 2048kb = 2MB, 1024kb = 1MB, 512kb = 1/2MB etc..
$max_file_size="1024";

// Maximum file size for all attachments combined in KB NOT Bytes! MAKE SURE your php.ini can handel it, post_max_size, upload_max_filesize, file_uploads, max_execution_time!
// 2048kb = 2MB, 1024kb = 1MB, 512kb = 1/2MB etc..
$max_file_total="2048";

// Value for the Submit Button
$submitvalue=" Skicka ";

// Value for the Reset Button
$resetvalue=" Ta bort ";

// Default subject? This will be sent if the user does not type in a subject
$defaultsubject="No Subject";

// Because many requested it, this feature will add a drop down box for the user to select a array of subjects that you specify below.
// True = Use this feature, False = do not use this feature
$use_subject_drop=true;

// This is an array of the email subjects the user can pick from. Make sure you keep the format of this array or you will get errors!
// Look at http://phphq.net/forums/viewtopic.php?p=836 for examples on how to use this feature.
$subjects=array("test","test2","test3");

// This is an array of the email address for the array above. There must be an email FOR EACH array value specified above. You can have only 1 department if you want.
//YOU MUST HAVE THE SAME AMMOUNT OF $subjects and $emails or this WILL NOT work correctly! The emails also must be in order for what you specify above!
// You can also seperate the emails by a comma to sent 1 department to multiple email addresses.
$emails=array("email");

// This is the message that is sent after the email has been sent. You can use html here.
// If you want to redirect users to another page on your website use this: <script type=\"text/javascript\">window.location=\"http://www.YOUR_URL.com/page.html\";</script>

$thanksmessage="Tack för din fråga! Din fråga kommer att besvaras inom 24 timmar.";
//$thanksmessage="<script type=\"text/javascript\">window.location=\"http://www.YOUR_URL.com/page.html\";</script>";
// Uncomment (remove the //'s) above to use redirect



/*
//================================================================================
* ! ATTENTION !
//================================================================================
: Don't edit below this line unless you know some php. Editing some variables or other stuff could cause undeseriable results!!
*/

// Will get the extension of the users file. For some reason trying to get the actual type of the file caused problems with certain browsers.

function get_ext($key) {
$key=strtolower(substr(strrchr($key, "."), 1));
// Cause there the same right?
$key=str_replace("jpeg","jpg",$key);
return $key;
}

function phattach($file,$name) {
global $boundary;

$fp=@fopen($file,"r");
$str=@fread($fp, filesize($file));
$str=@chunk_split(base64_encode($str));
$message="--".$boundary."\n";
$message.="Content-Type: application/octet-stream; name=\"".$name."\"\n";
//$message.="Content-disposition: attachment\n"; Thanks goes to someone named Chris (I think, it was awhile ago) for his fix below!
$message.="Content-disposition: attachment; filename=\"".$name."\"\n";
$message.="Content-Transfer-Encoding: base64\n";
$message.="\n";
$message.="$str\n";
$message.="\n";

return $message;
}

//Little bit of security from people forging headers. People are mean sometimes :(
function clean($key) {
$key=str_replace("\r", "", $key);
$key=str_replace("\n", "", $key);
$find=array(
"/bcc\:/i",
"/Content\-Type\:/i",
"/Mime\-Type\:/i",
"/cc\:/i",
"/to\:/i"
);
$key=preg_replace($find,"",$key);
return $key;
}

// Safe for register_globals=on =)

$error="";
$types="";
$sent_mail=false;

// Do some loopy stuff for the valid file types so people can see what types are valid before they try and upload invalid ones.

$ext_count=count($allowtypes);
$i=0;

foreach($allowtypes AS $extension) {

//Gets rid of the last comma

If($i <= $ext_count-2) {
$types .="*.".$extension.", ";
} Else {
$types .="*.".$extension;
}
$i++;
}
unset($i,$ext_count); // why not


// If they post the form start the mailin'!

If($_POST['submit']==true) {
extract($_POST, EXTR_SKIP);

// Check the form for errors

If(trim($yourname)=="") {
$error.="Du måste fylla i ditt namn!<br />";
}

If(trim($youremail)=="") {
$error.="Du skrev inte in någon e-mail adress!<br />";
} Elseif(!eregi("^([a-z0-9_]|\\-|\\.)+@(([a-z0-9_]|\\-)+\\.)+[a-z]{2,4}\$",$youremail)) {
$error.="Invalid email address.<br />";
}

If(trim($emailsubject)=="") {
$emailsubject=$defaultsubject;
}

If(trim($yourmessage)=="") {
$error.="Du måste fylla i ett medelande!<br />";
}

// Verify Attchment info

If($allowattach > 0) {

//Loopish

For($i=0; $i <= $allowattach-1; $i++) {

If($_FILES['attachment']['name'][$i]) {

$ext=get_ext($_FILES['attachment']['name'][$i]);
$size=$_FILES['attachment']['size'][$i];
$max_bytes=$max_file_size*1024;

//Check if the file type uploaded is a valid file type.

If(!in_array($ext, $allowtypes)) {

$error.= "Invalid extension for your file: ".$_FILES['attachment']['name'][$i].", only ".$types." are allowed.<br />";

//Check the size of each file

} Elseif($size > $max_bytes) {
$error.= "Your file: ".$_FILES['attachment']['name'][$i]." is to big. Max file size is ".$max_file_size."kb.<br />";
}

} // If Files

} // For

//Tally the size of all the files uploaded, check if it's over the ammount.

$total_size=array_sum($_FILES['attachment']['size']);

$max_file_total_bytes=$max_file_total*1024;

If($total_size > $max_file_total_bytes) {
$error.="The max size allowed for all your files is ".$max_file_total."kb<br />";
}

} // If Allowattach

If($error) {

$display_message=$error;

} Else {

If($use_subject_drop AND is_array($subjects) AND is_array($emails)) {
$subject_count=count($subjects);
$email_count=count($emails);

If($subject_count==$email_count) {

$myemail=$emails[$emailsubject];
$emailsubject=$subjects[$emailsubject];

}

}


$boundary=md5(uniqid(time()));

//Little bit of security from people forging headers. People are mean sometimes :(

$yourname=clean($yourname);
$yourmessage=clean($yourmessage);
$youremail=clean($youremail);

//Headers

$headers="From: ".$yourname." <".$youremail.">\n";
$headers.="Reply-To: ".$yourname." <".$youremail.">\n";
$headers.="MIME-Version: 1.0\n";
$headers.="Content-Type: multipart/mixed; boundary=\"".$boundary."\"\n";
$headers.="X-Sender: ".$_SERVER['REMOTE_ADDR']."\n";
$headers.="X-Mailer: PHP/".phpversion()."\n";
$headers.="X-Priority: ".$priority."\n";
$headers.="Return-Path: <".$youremail.">\n";
$headers.="This is a multi-part message in MIME format.\n";

//Message

$message = "--".$boundary."\n";
$message.="Content-Type: text/plain; charset=\"iso-8859-1\"\n";
$message.="Content-Transfer-Encoding: quoted-printable\n";
$message.="\n";
$message.="$yourmessage";
$message.="\n";

//Lets attach to something! =)

If($allowattach > 0) {

For($i=0; $i <= $allowattach-1; $i++) {

If($_FILES['attachment']['name'][$i]) {

$message.=phattach($_FILES['attachment']['tmp_name'][$i],$_FILES['attachment']['name'][$i]);

}

} //For

} // If


// End the message

$message.="--".$boundary."--\n";

// Send the completed message

If(!mail($myemail,$emailsubject,$message,$headers)) {

Exit("An error has occured, please report this to the website administrator.\n");

} Else {

$sent_mail=true;

}

} // Else

} // $_POST

/*
//================================================================================
* Start the form layout
//================================================================================
:- Please know what your doing before editing below. Sorry for the stop and start php.. people requested that I use only html for the form..
*/
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<link rel="icon" href="bild/formu.ico" type="image/x-icon">
<link rel="shortcut icon" href="bild/formu.ico" type="image/x-icon">
<!--
var browserName=navigator.appName;

if (browserName=="Microsoft Internet Explorer") {
document.write('<link rel="stylesheet" type="text/css" href="iemall.css" media="screen">');
}
else {
document.write('<link rel="stylesheet" type="text/css" href="index.css" media="screen">');
}
//-->
<meta http-equiv="Content-Language" content="en-us" />
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title><?php echo $websitename; ?></title>
<script type="text/javascript">
var error="";
e_regex = /^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,})+$/;

function Checkit(theform) {

if(theform.yourname.value=="") {
error+="You did not enter your name\n";
}

if(theform.youremail.value=="") {
error+="You did not enter your email\n";
} else if(!e_regex.test(theform.youremail.value)) {
error+="Invalid email address\n";
}

if(theform.yourmessage.value=="") {
error+="You did not enter your message\n";
}

if(error) {
alert('**The form returned the following errors:**\n\n' + error);
error="";
return false;
} else {
return true;
}
}
</script>


</head>
<body>
<?If($display_message) {?>

<div align="center" class="error_message"><b><?=$display_message;?></b></div>
<br />

<?}?>

<?If($sent_mail!=true) {?>

<form method="post" action="<?=$_SERVER['PHP_SELF'];?>" enctype="multipart/form-data" name="phmailer" onsubmit="return Checkit(this);">
<table id="phpf" width="500" border="0">
<tr>
<td height="50" align="right" valign="top">
<div id="php1">
<div class="php2">
<div class="p1"></div>
<div class="p2"></div>
<div class="p3"></div>
<div class="p4"></div>
</td>
</tr>
</table>
<table align="center" class="table">
<tr>
<td colspan="2" class="table_header" width="100%"><?=$websitename;?></td>
</tr>
<?If($allowattach > 0) {?>
<tr>
<td width="100%" class="attach_info" colspan="2">
<b>Valid Attachment Types:</b> <?=$types?><br />
<b>Max size per file:</b> <?=$max_file_size?>kb.<br />
<b>Max combined file size:</b> <?=$max_file_total?>kb.
</td>
</tr>
<?}?>

<tr>
<td width="30%" class="table_body">Ditt namn:</td>
<td width="70%" class="table_body"><input name="yourname" type="text" size="30" value="<?=stripslashes(htmlspecialchars($yourname));?>" /><span class="error_message">*</span></td>
</tr>
<tr>
<td width="30%" class="table_body">Din Email:</td>
<td width="70%" class="table_body"><input name="youremail" type="text" size="30" value="<?=stripslashes(htmlspecialchars($youremail));?>" /><span class="error_message">*</span></td>
</tr>
<tr>
<td width="30%" class="table_body">Ämne:</td>
<td width="70%" class="table_body">

<?If($use_subject_drop AND is_array($subjects)) {?>
<select name="emailsubject" size="1">
<?while(list($key,$val)=each($subjects)) {?>

<option value="<?=intval($key);?>"><?=htmlspecialchars(stripslashes($val));?></option>

<?}?>
</select>


<?} Else {?>

<input name="emailsubject" type="text" size="30" value="<?=stripslashes(htmlspecialchars($emailsubject));?>" />

<?}?>

</td>
</tr>
<tr>
<td colspan="2" width="100%" class="table_body">Ditt medelande:<span class="error_message">*</span><br />
<div align="center">
<textarea name="yourmessage" rows="8" cols="60"><?=stripslashes(htmlspecialchars($yourmessage));?></textarea>
</div>
</td>
</tr>
<tr>
<td colspan="2" width="100%" class="table_footer">
<input type="hidden" name="submit" value="true" />
<input type="submit" value="<?=$submitvalue;?>" /> &nbsp;
<input type="reset" value="<?=$resetvalue;?>" />
</td>
</tr>
</table>
</form>

<?} Else {?>

<div align="center" class="thanks_message"><?=$thanksmessage;?></div>
<br />
<br />

<?}?>
</table>
</body>
</html>
[/php]

Och detta är css mallen:

Kod: Markera allt

.body {background-color: #E2DCC6; font-family:verdana; font-size: 12px; color: #000000;}
#div {background-color: #FFF0BB; font-family:verdana; font-size: 12px; color: #000000; position: relative; width: 988px; height: 990px;}
#div11 {background-color: #FFF0BB; font-family:verdana; font-size: 12px; color: #000000; position: absolute; width: 721px; height: 400px;  position: absolute; right: 150px; top: 120px;}
#div12 {background-color: #FFF0BB; font-family:verdana; font-size: 12px; color: #000000; position: absolute; width: 140px; height: 130px;  position: absolute; right: 13px; top: 125px;}
#div2 {background-color: #FFD75C; border-bottom: 1px solid #E2DCC6; font-family:verdana; font-size: 12px; color: #000000; position: relative; width: 140px; height: 15px;}
#div3 {background-color: #FFD75C; font-family:verdana; font-size: 12px; color: #000000; position: relative; width: 140px; height: 15px;}
.bild {image-size: width: 8px; height: 7px; position:absolute;right:1px;top:4px;}
#bak1 {background: #FFF0BB;}
.bak2 {background: #E2DCC6;}
#bak3 {background: #FFF0BB;}
.bak4 {background: #FFF0BB;}
.a1{margin: 0 16px; height: 1px; overflow: hidden; background: #FFF0BB;}
.a2{margin: 0 13px; height: 1px; overflow: hidden; background: #FFF0BB;}
.a3{margin: 0 11px; height: 1px; overflow: hidden; background: #FFF0BB;}
.a4{margin: 0 9px; height: 1px; overflow: hidden; background: #FFF0BB;}
.a5{margin: 0 8px; height: 1px; overflow: hidden; background: #FFF0BB;}
.a6{margin: 0 7px; height: 1px; overflow: hidden; background: #FFF0BB;}
.a7{margin: 0 6px; height: 1px; overflow: hidden; background: #FFF0BB;}
.a8{margin: 0 5px; height: 1px; overflow: hidden; background: #FFF0BB;}
.a9{margin: 0 4px; height: 1px; overflow: hidden; background: #FFF0BB;}
.a10{margin: 0 3px; height: 2px; overflow: hidden; background: #FFF0BB;}
.a11{margin: 0 2px; height: 2px; overflow: hidden; background: #FFF0BB;}
.a12{margin: 0 1px; height: 3px; overflow: hidden; background: #FFF0BB;}
.r5{margin: 0 5px; height: 1px; overflow: hidden; background: #FFD75C;}
.r6{margin: 0 3px; height: 1px; overflow: hidden; background: #FFD75C;}
.r7{margin: 0 2px; height: 1px; overflow: hidden; background: #FFD75C;}
.r8{margin: 0 1px; height: 2px; overflow: hidden; background: #FFD75C;}
.r9{margin: 0 1px; height: 2px; overflow: hidden; background: #FFD75C;}
.r10{margin: 0 2px; height: 1px; overflow: hidden; background: #FFD75C;}
.r11{margin: 0 3px; height: 1px; overflow: hidden; background: #FFD75C;}
.r12{margin: 0 5px; height: 1px; overflow: hidden; background: #FFD75C;}
.r13{margin: 0 5px; height: 1px; overflow: hidden; background: #FFD75C;}
.r14{margin: 0 3px; height: 1px; overflow: hidden; background: #FFD75C;}
.r15{margin: 0 2px; height: 1px; overflow: hidden; background: #FFD75C;}
.r16{margin: 0 1px; height: 2px; overflow: hidden; background: #FFD75C;}
#tab1 {background-color: #FFD75C; font-family:verdana; font-size: 12px; color: #000000; position: absolute; width: 140px; height: 15px; position: absolute; left: 15px; top: 130px;}
#tab2 {background-color: #FFD75C; font-family:verdana; font-size: 12px; color: #000000; position: absolute; width: 140px; height: 15px; position: absolute; left: 15px; top: 145px;}
#tab3 {background-color: #FFD75C; font-family:verdana; font-size: 12px; color: #000000; position: absolute; width: 140px; height: 15px; position: absolute; left: 15px; top: 160px;}
#tab4 {background-color: #FFD75C; font-family:verdana; font-size: 12px; color: #000000; position: absolute; width: 140px; height: 15px; position: absolute; left: 15px; top: 175px;}
#tab5 {background-color: #FFD75C; font-family:verdana; font-size: 12px; color: #000000; position: absolute; width: 140px; height: 15px; position: absolute; left: 15px; top: 190px;}
#tab6 {background-color: #FFD75C; font-family:verdana; font-size: 12px; color: #000000; position: absolute; width: 140px; height: 15px; position: absolute; left: 15px; top: 205px;}
#tab7 {background-color: #FFD75C; font-family:verdana; font-size: 12px; color: #000000; position: absolute; width: 140px; height: 15px; position: absolute; left: 15px; top: 220px;}
#tab8 {background-color: #FFD75C; font-family:verdana; font-size: 12px; color: #000000; position: absolute; width: 140px; height: 15px; position: absolute; left: 15px; top: 235px;}
#tab9 {background-color: #FFD75C; font-family:verdana; font-size: 12px; color: #000000; position: absolute; width: 140px; height: 15px; position: absolute; left: 15px; top: 250px;}
#tab10 {background-color: #FFD75C; font-family:verdana; font-size: 12px; color: #000000; position: absolute; width: 140px; height: 15px; position: absolute; left: 15px; top: 265px;}
#tab13 {background-color: #FFD75C; font-family:verdana; font-size: 12px; color: #000000; position: absolute; width: 140px; height: 15px; position: absolute; left: 15px; top: 280px;}
#tab11 {position: relative; width: 148px; height: 5px; position: absolute; left: 11px; top: 122px;}
#tab12 {position: relative; width: 148px; height: 5px; position: absolute; left: 11px; top: 292px;}
#mitt {background-color: #E2DCC6; font-family:verdana; font-size: 12px; color: #000000; position: absolute; width: 697px; height: 700px; position: absolute; left: 156px; top: 125px;}
.val {font-family:verdana; font-size: 12px; color: #000000;}
#php1 {background: #FFF0BB;}
.php2 {background: #E2DCC6;}
.p1 {margin: 0 5px; height: 1px; overflow: hidden; background: #FFD75C;}
.p2 {margin: 0 3px; height: 1px; overflow: hidden; background: #FFD75C;}
.p3 {margin: 0 2px; height: 1px; overflow: hidden; background: #FFD75C;}
.p4 {margin: 0 1px; height: 2px; overflow: hidden; background: #FFD75C;}
#phpf {position: relative; width: 148px; height: 5px; position: absolute; left: 11px; top: 122px;}
.body {background-color:#FFFFFF; font-family: Verdana, Arial, sans-serif; font-size: 12pt; color: #000000;}
.error_message {font-family: Verdana, Arial, sans-serif; font-size: 11pt; color: #FF0000;}
.thanks_message {font-family: Verdana, Arial, sans-serif; font-size: 11pt; color: #000000;}
.table {border-collapse:collapse; width:500px;}
.table_header {background-color:#FFD75C; font-family: Verdana, Arial, sans-serif; font-size: 11pt; font-weight:bold; color: #000000; text-align:center; padding:2px;}
.attach_info {background-color:#EBEBEB;	font-family: Verdana, Arial, sans-serif; font-size: 8pt; color: #000000; padding:4px;}
.table_body {background-color:#FFF0BB; font-family: Verdana, Arial, sans-serif;	font-size: 10pt; color: #000000; padding:2px;}
.table_footer {background-color:#FFD75C; text-align:center; padding:2px;}
.copyright {border:0px;	font-family: Verdana, Arial, sans-serif; font-size: 9pt; color: #000000; text-align:right;}
a:link {text-decoration:none; color: #000000;}
a:visited {text-decoration:none; color: #000000;}
a:hover {text-decoration:none; color: #000000;}
input,select,textarea {font-family: Verdana, Arial, sans-serif;	font-size: 10pt; color: #000000; background-color:#FFF0BB; border:1px solid #000000;}
form {padding:0px; margin:0px;}
Som sagt varför fungerar inte min css mall ?
Mvh Forcevision
http://www.forcevision.se för företag och privatpersoner.

Skriv svar