Hej med jer håber i kan hjælpe
Vi vil gerne indsætte flere billeder i dette script:
----------------------------------------------------------
Her opretter jeg billedet
<form action="index.php?side=kobogsalg5" method="post" enctype="multipart/form-data">
<input type="hidden" name="referer" value="post_news">
<br>
<select name='nummer' id='nummer' size='1'>
<option value='1' tabindex='1'>Vist</option>
<option value='2' tabindex='25'>Ikke vist</option>
</select><br><br>
Titel<br><input type="text" name="title" style="width: 300px"><br><br>
Beskrivelse<br><textarea name="text" rows="5" cols="0" style="width: 300px"></textarea><br><br>
Navn<br><input type="text" name="navn" style="width: 300px"><br><br>
Pris<br><input type="text" name="pris" style="width: 300px"><br><br>
Tlf. nummer<br><input type="text" name="mobil" style="width: 300px"><br><br>
E-mail<br><input type="text" name="mail" style="width: 300px"><br><br>
Billede<br><input type="file" name="image" style="width: 305px"><br><br>
<a href="files.list.php" target="_blank"><br>
<input type="submit" value="Send">
</form>
---------------------------------------------------------
Her er min form.handle:
if ($_POST['referer'] == 'post_news') {
if ($_FILES['image']['name'] != '') {
$image = time().substr($_FILES['image']['name'],strrpos($_FILES['image']['name'],'.'));
move_uploaded_file($_FILES['image']['tmp_name'], '../adminmodul/kobogsalg/files/'.$image);
} elseif ($_POST['standard'] != '') {
$image = $_POST['standard'];
} else {
$image = '';
}
mysql_query("INSERT INTO kobogsalg VALUES ('','".$_POST['nummer']."','".$_POST['title']."','".$_POST['navn']."','".$_POST['text']."','".$image."','".$_POST['pris']."','".$_POST['mail']."','".$_POST['mobil']."')") or die(mysql_error());
header("Location: index.php?side=kobogsalg4");
}
if ($_POST['referer'] == 'edit_news') {
mysql_query("UPDATE kobogsalg SET title='".$_POST['title']."', text='".$_POST['text']."', navn='".$_POST['navn']."', mobil='".$_POST['mobil']."', pris='".$_POST['pris']."', mail='".$_POST['mail']."', nummer='".$_POST['nummer']."' WHERE id=".$_POST['id']."") or die(mysql_error());
header("Location: index.php?side=kobogsalg4?offset=".$_POST['offset']);
}
----------------------------------------------------------
Her viser jeg nyheden
<?php
include_once('../inc.config.php');
mysql_connect($cfg['mysql']['host'],$cfg['mysql']['username'],$cfg['mysql']['password']);
mysql_select_db($cfg['mysql']['database']);
$query = mysql_query("SELECT * FROM kobogsalg WHERE id=".$_GET['id']."") or die(mysql_error());
while ($row = mysql_fetch_assoc($query)) {
if ($i++ != 0) echo '<div class="hr"></div>';
echo '<h3>'.$row['title'].' <html></html></h3> ';
echo empty($row['image']) ? '' : '<img src="adminmodul/kobogsalg/files/'.$row['image'].'"width="550" class="image" border="0">';
echo '<h4> <strong>Pris:</strong> '.$row['pris'].'</h4>';
echo '<h4> <strong>Sælges af:</strong> '.$row['navn'].'</h4>';
echo '<h4> <strong>Tlf:</strong> '.$row['mobil'].'</h4>';
echo '<h4> <strong>E-mail:</strong> '.$row['mail'].'</h4>';
echo '<h4> '.$row['text'].'</h4>';
}
?>
----------------------------------------------------------
Vil gerne kunne sætte max size på billedet evt rezize.
på forhånd tak.
Indlæg senest redigeret d. 18.04.2008 09:12 af Bruger #13629