Sorry my friend but im too dum or too Newbie.
I prefer the 2nd 😉
The HtmlT.php is just the form with the field and 1 file uploader.
HtmlT.php
include("config.inc.php");
include("funcionsT.inc.php");
.
.
.
<body>
<form enctype='multipart/form-data' action='HtmlT.php' method='post' name='upload_form'>
<table width="100%" border="0" cellpadding="0" cellspacing="0" bordercolor="#666666" bgcolor="#999999">
.
.
<tr>
<td bgcolor="#0000FF"> </td>
<td width="20%"><div align="right" class="style5">Artist/Band Name </div></td>
<td width="2%" bgcolor="#0099FF"> </td>
<td width="30%">
<div align="center">
<input name="artist" type="text" value = $_POST[artist] size="34">
</div>
</td>
</tr>
<tr>
<td bgcolor="#0000FF"> </td>
<td width="20%"><div align="right" class="style5">Album/Song Title</div></td>
<td width="2%" bgcolor="#0099FF"> </td>
<td width="30%"><div align="center">
<input name="song" type="text" value = $_POST[song] size="34">
</div></td>
<td width="2%" bgcolor="#0099FF"> </td>
<td width="20%"><span class="style8">*</span><span class="style17"> <span class="style8"><span class="style21">Please Fill This Field. </span></span></span></td>
<td bgcolor="#0000FF"> </td>
</tr>
<tr>
<td bgcolor="#0000FF"> </td>
<td width="20%"><div align="right" class="style5">Label Name </div></td>
<td width="2%" bgcolor="#0099FF"> </td>
<td width="30%"><div align="center">
<input name="label" type="text" size="34" value =$_POST[label]>
</div></td>
<td width="2%" bgcolor="#0099FF"> </td>
<td width="20%"><span class="style8">*</span><span class="style17"> <span class="style8"><span class="style21">Please Fill This Field. </span></span></span></td>
<td bgcolor="#0000FF"> </td>
</tr>
<tr>
.
.
.
<tr>
<td bgcolor="#0000FF"> </td>
<td><div align="right"></div></td>
<td bgcolor="#0099FF"> </td>
<td><div align="center">
<input name=' photo_filename[]' type='file' class="style22" />
</div></td>
.
.
<div align="center">
<input name="Submit" type="submit" class="style5" value="Submit your infos">
</div>
</td>
I v include the function.php that handles the errors
function.inc.php
if(isset($Submit)){
$error_msg='';
if (trim($artist)=='' || strlen(trim($artist)) > 30 || ereg('[^[:space:]a-zA-Z0-9_.-]{1,}', $artist)) {
$error_msg.="<li>Please enter a <strong>Artist/Band Name </strong>max 30 max char long No special characters</li>";
}
if(trim($song)=='' || strlen(trim($song)) > 30 || ereg('[^[:space:]a-zA-Z0-9_.-]{1,}', $song)) {
$error_msg.="<li>Please enter a <strong>Album/Song Title </strong>max 30 max char long No special characters</li>";
}
if(trim($label)=='' || strlen(trim($label)) > 30 || ereg('[^[:space:]a-zA-Z0-9_.-]{1,}', $label)) {
$error_msg.="<li>Please enter a <strong>Label </strong>max 30 max char long No special characters</li>";
}
if(trim($serial)=='' || strlen(trim($serial)) > 30 || ereg('[^[:space:]a-zA-Z0-9_.-]{1,}', $serial)) {
$error_msg.="<li>Please enter a <strong>Serial No </strong>max 30 max char long No special characters</li>";
}
// display error message if any, if not, proceed to other processing
if($error_msg==''){
echo "<script type=\"text/javascript\">window.location=\"uploadT.php\"</script>";
} else {
$valid_error = "<ol><font color=red>$error_msg</font></ol>";
}
}
?>
and finaly uploadT.php do all the job
<?php
include("config.inc.php");
// initialization
$result_final = "";
$counter = 0;
// List of our known photo types
$known_photo_types = array(
'image/pjpeg' => 'jpg',
'image/jpeg' => 'jpg',
'image/gif' => 'gif',
'image/bmp' => 'bmp',
'image/x-png' => 'png'
);
// GD Function List
$gd_function_suffix = array(
'image/pjpeg' => 'JPEG',
'image/jpeg' => 'JPEG',
'image/gif' => 'GIF',
'image/bmp' => 'WBMP',
'image/x-png' => 'PNG'
);
// Fetch the photo array sent by preupload.php
$photos_uploaded = $_FILES['photo_filename'];
// Fetch the photo caption array
$test = explode('|',$categoryboth);
$photo_category= $test[0];
$Gerne = $test[1];
$enddate=date ("Y-m-d H:i:s",mktime(date("H"),date("i"),date("s"), date("m"),date("d")+$day_set,date("Y")));
$artist=$_POST['artist'];
$song=$_POST['song'];
$label=$_POST['label'];
$serial=$_POST['serial'];
$pr_cntr=$_POST['pr_cntr'];
$pr_date=$_POST['pr_date'];
$cont_it=$_POST['cont_it'];
$cont_cov=$_POST['cont_cov'];
$header=$_POST['header'];
$elm1=$_POST['elm1'];
$new_shpm_pol=$_POST['new_shpm_pol'];
$photo_caption = $_POST['photo_caption'];
while( $counter <= count($photos_uploaded) )
{
if($photos_uploaded['size'][$counter] > 0)
{
if(!array_key_exists($photos_uploaded['type'][$counter], $known_photo_types))
{
$result_final .= "File ".($counter+1)." is not a photo<br />";
}
else
{
$query = "INSERT INTO gallery_photos(
`photo_filename`,
`photo_caption`,
`photo_category`,`Gerne`,
`artist`,
`song`,
`label`,
`serial`,
`pr_cntr`,
`pr_date`,
`cont_it`,
`cont_cov`,
`header`,
`elm1`,
`new_shpm_pol`,
`photo_category1`,
`enddate`)
VALUES(
'0',
'".addslashes($photo_caption[$counter])."',
'$photo_category','$Gerne',
'$artist',
'$song',
'$label',
'$serial',
'$pr_cntr',
'$pr_date',
'$cont_it',
'$cont_cov',
'$header',
'$elm1',
'$new_shpm_pol',
'".addslashes($_POST['category1'])."',
'$enddate')" ;
echo $query;
$result = mysql_query($query);
if (!$result){
echo "<br>Error with query is ".mysql_error();
}
creates thubnails...etc...
when i use this
if($error_msg==''){
echo "<script type=\"text/javascript\">window.location=\"uploadT.php\"</script>";
if no errors the uploadTphp is displayed but do nothing.
not submiting he infos in my database.
Sorry again if i m so dum 🆒
And Thnx AGAIN for your Time 🙂