Pogledajte određenu poruku
Staro 26. 02. 2014.   #3
stanke
član
Certified
 
Datum učlanjenja: 06.09.2012
Poruke: 64
Hvala: 0
342 "Hvala" u 10 poruka
stanke is on a distinguished roadstanke is on a distinguished roadstanke is on a distinguished roadstanke is on a distinguished road
Default

ovo je forma
$id = (int)$_GET['cat_id'];
//If is existing item
if($id)
{
//getExisting information from existing item
$item= Category::getCategory($id);
}
else
{
//object of class item
$item = new Category();
}

?>
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<title>Untitled Document</title>
</head>

<body>
<h2>Category Maint</h2>
<form action="index.php?content=categories" method="post" name="maint" enctype="multipart/form-data">
<fieldset class="maintform">
<legend><?php echo ($id)? 'ID: '.$id:'Add a Category' ;?></legend>
<ul>
<li>
<label class="required">Category</label><br>
<input type="text" name="cat_name" class="required" value="<?php echo htmlspecialchars( $item->getCat_name()); ?>">

</li>

<li>
<label>Descrioption</label><br>
<textarea rows="5" cols="60" name="cat_description"><?php echo htmlspecialchars($item->getCat_description()); ?></textarea>
</li>

<li>
<label>Image</label><br>
//<input type="file" name="imag_cat">
<input type="text" name="cat_image" value="<?php echo htmlspecialchars( $item->getCat_image());?>">


</li>

</ul>
<?php
//create securoty token and session
$salt = 'SomeSalt';
$token = sha1(mt_rand(1,1000000).$salt);
$_SESSION['token'] = $token;
?>
<input type="hidden" name="cat_id" value="<?php echo $item->getCat_id(); ?>" >
<input type="hidden" name="task" value="category.maint">
<input type="hidden" name="token" value="<?php echo $token ; ?>">
<input type="submit" name="save" value="Save">
<a href="index.php?content=categories">Cancel</a>
</fieldset>
</form>
<?php //endif;?>
</body>
</html>

Meni treba za
<label>Image</label><br>
//<input type="file" name="imag_cat">
//Uzima iz polja naziv slike i stavlja je u bazu
//echo htmlspecialchars( $item->getCat_image()); varaca ime slike iz baze
<input type="text" name="cat_image" value="<?php echo htmlspecialchars( $item->getCat_image());?>">


ja bi hteo da preko <input type="file" name="imag_cat"> korisnik odabere sliku koja je vec uplodovana, da moze da promeni sliku kako bi se sacuvao nov naziv u bazi ili da odabere sliku preko <input type="file" name="imag_cat"> a da dodelim vrednost <input type="text">
stanke je offline   Odgovorite uz citat