Hej:-)
Er der nogen der kan gennemskue hvorfor nedenstående tilføjer værdien valgt til placering i feltet type og intet i feltet placering...?!
synes jeg har tjekket alt, men det har jeg åbenbart ikke:-)
<?
include("../config.php");
if(isset($_POST[Are]))
{
$Page = $_POST[Page];
$Type = $_POST[Type];
$Type = $_POST[Placering];
$Name = $_POST[Name];
$Nickname = $_POST[Nickname];
$Adresse = $_POST[Adresse];
$Postnr = $_POST[Postnr];
$Born = $_POST[Born];
$Playing_in_GSI_since = $_POST[Playing_in_GSI_since];
$Position = $_POST[Position];
$Favorite_team = $_POST[Favorite_team];
$Favrite_player = $_POST[Favrite_player];
$Meritter = $_POST[Meritter];
$Trojenr = $_POST[Trojenr];
$Mail = $_POST[Mail];
$Telefonnr = $_POST[Telefonnr];
$Former_clubs = $_POST[Former_clubs];
$About_the_player = $_POST[About_the_player];
$Statistik = $_POST[Statistik];
$Picture = $_FILES[Picture][name];
$t = time();
function getFileExtension($str) {
$i = strrpos($str,".");
if (!$i) { return ""; }
$l = strlen($str) - $i;
$ext = substr($str,$i+1,$l);
$ext = strtolower($ext);
if($ext == jpg || $ext == jpeg || $ext == gif || $ext == png)
{
}
else
{
echo"<strong>$ext</strong> type is not accepted.Please upload only JPG, Gif and PNG Extenstions";
exit();
}
return $ext;
}
function CopyImageFileGD($name,$ext,$path_thumbs,$path_big,$newwidth,$newheight) {
$t = time();
$tempname = strtolower($name);
$Newname = "$tempname$t.$ext";
$Temp_type = $_FILES[$name]['type'];
$Temp_name = $_FILES[$name]['name'];
$Temp_size = $_FILES[$name]['size'];
$Temp_tmp = $_FILES[$name]['tmp_name'];
if($Temp_size){
if($Temp_type == "image/pjpeg" || $Temp_type == "image/jpeg"){
$new_img = imagecreatefromjpeg($Temp_tmp);
}elseif($Temp_type == "image/x-png" || $Temp_type == "image/png"){
$new_img = imagecreatefrompng($Temp_tmp);
}elseif($Temp_type == "image/gif"){
$new_img = imagecreatefromgif($Temp_tmp);
}
list($width, $height) = getimagesize($Temp_tmp);
if (function_exists(imagecreatetruecolor)){
$resized_img = imagecreatetruecolor($newwidth,$newheight);
}
imagecopyresized($resized_img, $new_img, 0, 0, 0, 0, $newwidth, $newheight, $width, $height);
$tempname = strtolower($name);
$Newname = "$tempname$t.$ext";
ImageJpeg ($resized_img,"$path_thumbs/$Newname");
ImageDestroy ($resized_img);
ImageDestroy ($new_img);
move_uploaded_file ($Temp_tmp, "$path_big/$Newname");
}
return $Newname;
}
$ExtPicture = getFileExtension($Picture);
if(!empty($Picture))
{
$NewPicture = CopyImageFileGD("Picture","$ExtPicture","../profiles_files/thumbs","../profiles_files","150","112");
}
$q1 = "INSERT INTO `profiles` (`ProfileID` , `Page` , `Type` , `Placering` , `Name` , `Nickname` , `Adresse` , `Postnr` , `Born` , `Playing_in_GSI_since` , `Position` , `Favorite_team` , `Favrite_player` ,`Meritter` , `Trojenr` , `Mail` , `Telefonnr` , `Former_clubs` , `About_the_player` ,`Statistik` , `Picture` ) VALUES ( '', '$Page', '$Type', '$Placering', '$Name','$Nickname','$Adresse','$Postnr', '$Born', '$Playing_in_GSI_since', '$Position', '$Favorite_team', '$Favrite_player','$Meritter','$Trojenr','$Mail','$Telefonnr', '$Former_clubs', '$About_the_player','$Statistik', '$NewPicture')";
mysql_query($q1) or die(mysql_error());
header("location:profiles.php");
}
else
{
include("header.php");
include("profilesnav.php");
?>
<form name="form1" method="POST" enctype="multipart/form-data" action="addprofiles.php">
<table border="0" width="600">
<tr>
<td width="252">Hold:</td>
<td width="549">
<select size="1" name="Page">
<option value="1">Serie 3</option>
<option value="2">Serie 6</option>
<option value="3">Veteran</option>
<option value="8">Damesenior</option>
<option value="4">U-10</option>
<option value="5">U-8</option>
<option value="6">U-7</option>
<option value="7">Stoppede spillere</option>
</select>
</td>
</tr>
<tr>
<td width="252">Type:</td>
<td width="549"><select size="1" name="Type">
<option value="Player">Player</option>
<option value="Coach">Coach</option>
</select>
</td>
</tr>
<tr>
<td width="252">Placering:</td>
<td width="549">
<select size="1" name="Placering">
<option value="4">Målmand</option>
<option value="3">Forsvar</option>
<option value="2">Midtbane</option>
<option value="1">Angreb</option>
</select>
</td>
</tr>
<tr>
<td width="252">Navn:</td>
<td width="549"><input type="text" name="Name" size="15" maxlength="50"></td>
</tr>
<tr>
<td width="252">Øgenavn:</td>
<td width="549"><input type="text" name="Nickname" size="15" maxlength="50"></td>
</tr>
<tr>
<td width="252">Adresse:</td>
<td width="549"><input type="text" name="Adresse" size="15" maxlength="50"></td>
</tr>
<tr>
<td width="252">Postnr:</td>
<td width="549"><input type="text" name="Postnr" size="15" maxlength="50"></td>
</tr>
<tr>
<td width="252">Fødselsdag:</td>
<td width="549"><input type="text" name="Born" size="15" maxlength="50"></td>
</tr>
<tr>
<td width="252">Spillet siden:</td>
<td width="549"><input type="text" name="Playing_in_GSI_since" size="15" maxlength="50"></td>
</tr>
<tr>
<td width="252">Position:</td>
<td width="549"><input type="text" name="Position" size="15" maxlength="50"></td>
</tr>
<tr>
<td width="252">Favorit hold:</td>
<td width="549"><input type="text" name="Favorite_team" size="15" maxlength="50"></td>
</tr>
<tr>
<td width="252">Favorit spiller(e):</td>
<td width="549"><input type="text" name="Favrite_player" size="15" maxlength="50"></td>
</tr>
<tr>
<td width="252">Meritter:</td>
<td width="549"><input type="text" name="Meritter" size="15" maxlength="50"></td>
</tr>
<tr>
<td width="252">Trøjenr:</td>
<td width="549"><input type="text" name="Trojenr" size="15" maxlength="50"></td>
</tr>
<tr>
<td width="252">Mail:</td>
<td width="549"><input type="text" name="Mail" size="15" maxlength="50"></td>
</tr>
<tr>
<td width="252">Telefonnr:</td>
<td width="549"><input type="text" name="Telefonnr" size="15" maxlength="50"></td>
</tr>
<tr>
<td width="252">Tidligere klubber:</td>
<td width="549"><input type="text" name="Former_clubs" size="15" maxlength="50"></td>
</tr>
<tr>
<td width="252">Om spilleren:</td>
<td width="549"><textarea rows="10" name="About_the_player" cols="50"></textarea></td>
</tr>
<tr>
<td width="252">Statistik:</td>
<td width="549"><textarea rows="10" name="Statistik" cols="50"></textarea></td>
</tr>
<tr>
<td width="252">Picture:</td>
<td width="549"><input type="file" name="Picture" size="20"></td>
</tr>
<tr>
<td width="252"> </td>
<td width="549"> </td>
</tr>
<tr>
<td width="252"> </td>
<td width="549"><input type="submit" value="Add Profiles" name="Are"></td>
</tr>
</table>
</form>
<?
include("footer.php");
}
?>