Jump to content

Recommended Posts

Can anyone show me a more consolidated way to write this? Its just uploading a file and displaying a status message.

 

if($pic != ""){
if(move_uploaded_file($_FILES['photo']['tmp_name'], $target1)&&chmod($target1,0664))
{
?><p class = "message">The file <?php echo $pic;?> has been uploaded, and your information has been added to the directory</p><?php
}
else {
?><p class = "message">Sorry, there was a problem uploading <?php echo $pic;?>.</p><?php
}
}
if($pic2!=""){
if(move_uploaded_file($_FILES['photo2']['tmp_name'], $target2)&&chmod($target2,0664))
{
?><p class = "message">The file <?php echo $pic2;?> has been uploaded, and your information has been added to the directory</p><?php
}
else {
?><p class = "message">Sorry, there was a problem uploading <?php echo $pic2;?>.</p><?php
}
}

For just two images with the two blocks of code right next to each other, I'd just keep that. You could refactor stuff out into an array and a loop but I'm not sold on it being worth the time.

Three images? Sure. More. Definitely. But just two? Meh.

This will actually be used for five images, I was just trying to give a small piece so I can work the rest out. Here is the bigger sample:

       if($pic != ""){
	if(move_uploaded_file($_FILES['photo']['tmp_name'], $target1)&&chmod($target1,0664))
	{
		?><p class = "message">The file <?php echo $pic;?> has been uploaded, and your information has been added to the directory</p><?php
	}else{
		?><p class = "message">Sorry, there was a problem uploading <?php echo $pic;?>.</p><?php
	}
}
if($pic2!=""){
	if(move_uploaded_file($_FILES['photo2']['tmp_name'], $target2)&&chmod($target2,0664))
	{
		?><p class = "message">The file <?php echo $pic2;?> has been uploaded, and your information has been added to the directory</p><?php
	}else{ 
		?><p class = "message">Sorry, there was a problem uploading <?php echo $pic2;?>.</p><?php
	}
}
if($pic3!=""){
	if(move_uploaded_file($_FILES['photo3']['tmp_name'], $target3)&&chmod($target3,0664))
	{
		?><p class = "message">The file <?php echo $pic3;?> has been uploaded, and your information has been added to the directory</p><?php
	}else{
		?><p class = "message">Sorry, there was a problem uploading <?php echo $pic3;?>.</p><?php
	}
}
if($pic4!=""){
	if(move_uploaded_file($_FILES['photo4']['tmp_name'], $target4)&&chmod($target4,0664))
	{
		?><p class = "message">The file <?php echo $pic4;?> has been uploaded, and your information has been added to the directory</p><?php
	}else{
		?><p class = "message">Sorry, there was a problem uploading <?php echo $pic4;?>.</p><?php
	}
}
if($pic5!=""){
	if(move_uploaded_file($_FILES['photo5']['tmp_name'], $target5)&&chmod($target5,0664))
	{
		?><p class = "message">The file <?php echo $pic5;?> has been uploaded, and your information has been added to the directory</p><?php
	}else{
		?><p class = "message">Sorry, there was a problem uploading <?php echo $pic5;?>.</p><?php
	}
}

How did I double post? I created the topic, got a response, and than replied. Do i just edit the code from my original posting?

It may have been a glitch, but there was another topic created exactly the same as this, that I deleted.

This will actually be used for five images, I was just trying to give a small piece so I can work the rest out.

Then definitely refactor. Stuff what you need into an array and foreach over that, like

$photos = array(...);
foreach ($photos as $photo) {
    if (...) {
        success
    } else {
        failure
    }
}

(and get the values you need from $photo).

Thanks for your help with this. I thought about going that route, but how would I increment the other two variables. I have the file name as photo,photo2,photo3,etc and also the path $target,$target2,etc

So I can push the variable "pic" into the array, but I'm not sure what to do with photo and target.

$photos = array($pic,$pic2,$pic3,$pic4,$pic5);
foreach ($photos as $photo){
if($photo != ""){
if(move_uploaded_file($_FILES['photo']['tmp_name'], $target)&&chmod($target,0664)){
success
}else{
failure
    }  
}

I think you'd be pleasantly surprised by the information provided if you var_dump 'd $_FILES

 

You'll want to rename your multipart input fields to an array:

<input name='files[1]' ... 'files[2]'

 

Then you can foreach( $_FILES['files'] as $upload )

 

Then, it won't matter if you have one or fifty file slots.

It'd be nice if you could do away with one of the variables (the three being $picN, 'photoN', and $targetB), then you could use key=>value pairs. Otherwise just use a multidimensional array.

$photos = array(array($pic, 'photo', $target), ...);

There is an SPL class specific for this use-case:

 

$photos = new MultipleIterator(MIT_NEED_ALL|MIT_KEYS_ASSOC);
$photos->attachIterator(new ArrayIterator(array($_FILES['photo']['tmp_name'],$_FILES['photo2']['tmp_name'],$_FILES['photo3']['tmp_name'],$_FILES['photo4']['tmp_name'],$_FILES['photo5']['tmp_name'])), 'source');
$photos->attachIterator(new ArrayIterator(array($target,$target2,$target3,$target4,$target5)), 'target');

foreach ($photos as $photo) {
    if (mv($photo['source'], $photo['target'])) {
        // success
    } else {
        // failure
    }
}

function mv($src, $dest, $mode = 0664) {
    return move_uploaded_file($src, $dest) && chmod($target, $mode);
}

Then you can foreach( $_FILES['files'] as $upload )

 

Nope, as per the manual:

 

foreach ($_FILES["pictures"]["error"] as $key => $error) {
    if ($error == UPLOAD_ERR_OK) {
        $tmp_name = $_FILES["pictures"]["tmp_name"][$key];
        $name = $_FILES["pictures"]["name"][$key];
        move_uploaded_file($tmp_name, "data/$name");
    }
}

I'm trying to keep up with this and google to learn at the same time. Ignace wrote of an SPL class, and that lost me. So I'll be studying that for awhile. I didn't realize this would get so complex, but its great because I learn more and more as I go.Im trying to avoid putting up too much code because I don't want anyone to feel I'm trying to get a "handout".  I am trying to edit my code, but the file doesn't seem to work. I have created a site for a newspaper. I have a file that creates articles with one main image and four related images, this works fine. This file I am working on is to update the article, and I can't update the images. Can you guys take a quick look and see if you notice anything, sorry if I'm messy, but I'm trying. Im basically getting a blank value for all the files I'm trying to upload, as they upload the paths are also stored in the database.

 

//START FORM PROCESSING
if(isset($_POST['submit'])){//Form has been submitted
$errors = array();

//This gets all the other information from the form
$articleTitle=$_POST['articleTitle'];
$articleAuthor=$_POST['articleAuthor'];
$pic=($_FILES['photo']['name']);
$pic2=($_FILES['photo2']['name']);
$pic3=($_FILES['photo3']['name']);
$pic4=($_FILES['photo4']['name']);
$pic5=($_FILES['photo5']['name']);
$articleDate=$_POST['articleDate'];
$articleFeatured=$_POST['articleFeatured'];
$articleIntroText=$_POST['articleIntroText'];
$articleContent=$_POST['articleContent'];
$articleCategory=$_POST['articleCategory'];
$articleCaption=$_POST['articleCaption'];
$articleCaption2=$_POST['articleCaption2'];
$articleCaption3=$_POST['articleCaption3'];
$articleCaption4=$_POST['articleCaption4'];
$articleCaption5=$_POST['articleCaption5'];

//This is the directory where images will be saved
$target = "../_images/_$articleCategory/";
$target1 = $target . basename( $_FILES['photo']['name']);
$target2 = $target . basename( $_FILES['photo2']['name']);
$target3 = $target . basename( $_FILES['photo3']['name']);
$target4 = $target . basename( $_FILES['photo4']['name']);
$target5 = $target . basename( $_FILES['photo5']['name']);

$query = "UPDATE articles SET
articleTitle = '{$articleTitle}',
articleImage = '$pic',
articleAuthor = '{$articleAuthor}',
articleDate = '{$articleDate}',
articleFeatured = '{$articleFeatured}',
articleIntroText = '{$articleIntroText}',
articleContent = '{$articleContent}',
articleImage2 = '$pic2',
articleImage3 = '$pic3',		
articleImage4 = '$pic4',
articleImage5 = '$pic5',
articleCategory='{$articleCategory}',
articleCaption='{$articleCaption}',
articleCaption2='{$articleCaption2}',
articleCaption3='{$articleCaption3}',
articleCaption4='{$articleCaption4}',
articleCaption5='{$articleCaption5}'
WHERE articleID = $articleID";
$result = mysql_query($query);
if(mysql_affected_rows()==1){
	// Success
	$message = "The article was successfully update";
}else{
	// Failed
	$message = "The article update failed";
	$message .= "<br />" . mysql_error();
}
if($articleFeatured == 1){
	featuredArticle();						
}
if($pic != ""){
	if(move_uploaded_file($_FILES['photo']['tmp_name'], $target1)&&chmod($target1,0664))
	{
		?><p class = "message">The file <?php echo $pic;?> has been uploaded, and your information has been added to the directory</p><?php
	}else{
		?><p class = "message">Sorry, there was a problem uploading <?php echo $pic;?>.</p><?php
	}
}
if($pic2!=""){
	if(move_uploaded_file($_FILES['photo2']['tmp_name'], $target2)&&chmod($target2,0664))
	{
		?><p class = "message">The file <?php echo $pic2;?> has been uploaded, and your information has been added to the directory</p><?php
	}else{ 
		?><p class = "message">Sorry, there was a problem uploading <?php echo $pic2;?>.</p><?php
	}
}
if($pic3!=""){
	if(move_uploaded_file($_FILES['photo3']['tmp_name'], $target3)&&chmod($target3,0664))
	{
		?><p class = "message">The file <?php echo $pic3;?> has been uploaded, and your information has been added to the directory</p><?php
	}else{
		?><p class = "message">Sorry, there was a problem uploading <?php echo $pic3;?>.</p><?php
	}
}
if($pic4!=""){
	if(move_uploaded_file($_FILES['photo4']['tmp_name'], $target4)&&chmod($target4,0664))
	{
		?><p class = "message">The file <?php echo $pic4;?> has been uploaded, and your information has been added to the directory</p><?php
	}else{
		?><p class = "message">Sorry, there was a problem uploading <?php echo $pic4;?>.</p><?php
	}
}
if($pic5!=""){
	if(move_uploaded_file($_FILES['photo5']['tmp_name'], $target5)&&chmod($target5,0664))
	{
		?><p class = "message">The file <?php echo $pic5;?> has been uploaded, and your information has been added to the directory</p><?php
	}else{
		?><p class = "message">Sorry, there was a problem uploading <?php echo $pic5;?>.</p><?php
	}
}
}
  
$result = mysql_query( "SELECT * FROM articles WHERE articleID = '$articleID'") 
or die("SELECT Error: ".mysql_error()); 
$row = mysql_fetch_array($result);
?>
  <section>
    <h2>Edit This Article</h2>
    <?php if(!empty($message)){echo "<p class =\"message\">" . $message . "</h3>";} ?>
    <?php if(!empty($errors)){display_errors($errors);}?>
    <form action="editArticleDetails.php?article=<?php echo $articleID; ?>" method="post">
      <h3> Article Title: </h3>
      <input type="text" name="articleTitle" value="<?php echo $row['articleTitle'];?>"size="60"/>
      
      <h3> Article Image name: </h3>
      <?php if($row['articleImage'] != ""){ ?>
      <input type="text" name="articleImage" value="<?php echo $row['articleImage'];?>" size="60"/>
      <img src="../_images/_<?php echo $row['articleCategory'];?>/<?php echo $row['articleImage'];?>" width="480">
      <h3>Upload New Image</h3>
      <?php } ?>
      
      <input type="hidden" name="size" value="350000">
      <input type="file" name="photo">
      
      <h3> Please Enter a Caption for the image here: </h3>
      <input type="text" name="articleCaption" value="<?php echo $row['articleCaption'];?>" size="60"/>
      <h3> Article Author: </h3>
      <input type="text" name="articleAuthor" value="<?php echo $row['articleAuthor'];?>" size="60"/>
      <h3> Article Date: </h3>
      <input type="text" name="articleDate" value="<?php echo $row['articleDate'];?>" size="60"/>
      <h3> Article Featured: </h3>
      <input type="radio" name="articleFeatured" value="0" 
	<?php if($row['articleFeatured'] ==1){ echo " checked";} ?> />
      Yes 
       
      <input type="radio" name="articleFeatured" value="1" 
            <?php if($row['articleFeatured'] ==0){ echo " checked";} ?>/>
      No
      <h3> Please choose a category </h3>
      <select name="articleCategory">
        <option value ="<?php echo $row['articleCategory'];?>" selected="selected" ><?php echo $row['articleCategory'];?></option>
        <option>news</option>
        <option>humaninterest</option>
        <option>sports</option>
        <option>columns</option>
        <option>letters</option>
        <option>marriages</option>
        <option>engagements</option>
        <option>obituaries</option>
      </select>
      <h3>
      <h3> Please Enter the intro text for the article: </h3>
      <textarea name="articleIntroText" cols="60" rows="10" class="mceIntro"/>
      <?php echo $row['articleIntroText'];?>
      </textarea>
      <h3> Article Content: </h3>
      <textarea name="articleContent" cols="60" rows="20" class="mceEditor"><?php echo $row['articleContent'];?></textarea>
      <h3> Related Image 1: </h3>
      <?php 
      if($row['articleImage2'] != ""){ ?>
      <input type="text" name="articleImage2" value="<?php echo $row['articleImage2'];?>" size="60"/>
      <img src="../_images/_<?php echo $row['articleCategory'];?>/<?php echo $row['articleImage2'];?>" width="480">
      <h3>Upload New Image</h3>
      <?php } ?>
      <input type="hidden" name="size" value="350000">
      <input type="file" name="photo2">
      <h3> Please Enter a Caption for the image here: </h3>
      <input type="text" name="articleCaption2" size="60" value="<?php echo $row['articleCaption2'];?>"/>
      <h3> Related Image 2: </h3>
      <?php if($row['articleImage3'] != ""){ ?>
      <input type="text" name="articleImage3" value="<?php echo $row['articleImage3'];?>" size="60"/>
      <img src="../_images/_<?php echo $row['articleCategory'];?>/<?php echo $row['articleImage3'];?>" width="480">
      <h3>Upload New Image</h3>
      <?php } ?>
      <input type="hidden" name="size" value="350000">
      <input type="file" name="photo3">
      <h3> Please Enter a Caption for the image here: </h3>
      <input type="text" name="articleCaption3" value="<?php echo $row['articleCaption3'];?>" size="60"/>
      <h3> Related Image 3: </h3>
      <?php if($row['articleImage4'] != ""){ ?>
      <input type="text" name="articleImage4" value="<?php echo $row['articleImage4'];?>" size="60"/>
      <img src="../_images/_<?php echo $row['articleCategory'];?>/<?php echo $row['articleImage4'];?>" width="480">
      <h3>Upload New Image</h3>
      <?php } ?>
      <input type="hidden" name="size" value="350000">
      <input type="file" name="photo4">
      <h3> Please Enter a Caption for the image here: </h3>
      <input type="text" name="articleCaption4" value="<?php echo $row['articleCaption4'];?>" size="60"/>
      <h3> Related Image 4: </h3>
      <?php if($row['articleImage5'] != ""){ ?>
      <input type="text" name="articleImage5" value="<?php echo $row['articleImage5'];?>" size="60"/>
      <img src="../_images/_<?php echo $row['articleCategory'];?>/<?php echo $row['articleImage5'];?>" width="480">
      <h3>Upload New Image</h3>
      <?php } ?>
      <input type="hidden" name="size" value="350000">
      <input type="file" name="photo5">
      <h3> Please Enter a Caption for the image here: </h3>
      <input type="text" name="articleCaption5" value="<?php echo $row['articleCaption5'];?>" size="60"/>
      <p><input type="submit" name="submit" value="Edit Article" /></p>
    </form>
    <h1><a href = "staff.php">Return to Menu</a></h1>


i'll make sure to eat my wheaties tomorrow, thank you for correcting me.

 

It was not meant to offend you, simply to show the OP that it's harder than that because the structure of _FILES changes when you upload multiple files.

It was not meant to offend you, simply to show the OP that it's harder than that because the structure of _FILES changes when you upload multiple files.

 

@Ignace

No offense taken.  You were correct in pointing out my post was half-assed

 

 

@ Spertuit

Dude, listen, if you're going to apply the same exact steps to more than one object, you should really think about loops.  ignace showed you how the foreach() looks, and i suggest u give it a whack.

I fixed the form and everything is working

 

//START FORM PROCESSING
if(isset($_POST['submit'])){//Form has been submitted

//This is the directory where images will be saved
$target = "../_images/_$articleCategory/";
$target = $target . basename( $_FILES['photo']['name']);

$target2 = "../_images/_$articleCategory/";
$target2 = $target2 . basename( $_FILES['photo2']['name']);

$target3 = "../_images/_$articleCategory/";
$target3 = $target3 . basename( $_FILES['photo3']['name']);

$target4 = "../_images/_$articleCategory/";
$target4 = $target4 . basename( $_FILES['photo4']['name']);

$target5 = "../_images/_$articleCategory/";
$target5 = $target5 . basename( $_FILES['photo5']['name']);


$errors = array();
$pic=($_FILES['photo']['name']);
$pic2=($_FILES['photo2']['name']);
$pic3=($_FILES['photo3']['name']);
$pic4=($_FILES['photo4']['name']);
$pic5=($_FILES['photo5']['name']);
$articleDate=$_POST['articleDate'];
$articleFeatured=$_POST['articleFeatured'];
$articleIntroText=$_POST['articleIntroText'];
$articleContent=$_POST['articleContent'];
$articleCategory=$_POST['articleCategory'];
$articleCaption=$_POST['articleCaption'];
$articleCaption2=$_POST['articleCaption2'];
$articleCaption3=$_POST['articleCaption3'];
$articleCaption4=$_POST['articleCaption4'];
$articleCaption5=$_POST['articleCaption5'];

if($pic != ""){
	if(move_uploaded_file($_FILES['photo']['tmp_name'], $target)&&chmod($target,0664))
	{
		?><p class = "message">The file <?php echo $pic;?> has been uploaded, and your information has been added to the directory</p><?php
	}else{
		?><p class = "message">Sorry, there was a problem uploading <?php echo $pic;?>.</p><?php
	}
}else{
	echo "I didn't get any info";
}
if($pic2!=""){
	if(move_uploaded_file($_FILES['photo2']['tmp_name'], $target2)&&chmod($target2,0664))
	{
		?><p class = "message">The file <?php echo $pic2;?> has been uploaded, and your information has been added to the directory</p><?php
	}else{ 
		?><p class = "message">Sorry, there was a problem uploading <?php echo $pic2;?>.</p><?php
	}
}
if($pic3!=""){
	if(move_uploaded_file($_FILES['photo3']['tmp_name'], $target3)&&chmod($target3,0664))
	{
		?><p class = "message">The file <?php echo $pic3;?> has been uploaded, and your information has been added to the directory</p><?php
	}else{
		?><p class = "message">Sorry, there was a problem uploading <?php echo $pic3;?>.</p><?php
	}
}
if($pic4!=""){
	if(move_uploaded_file($_FILES['photo4']['tmp_name'], $target4)&&chmod($target4,0664))
	{
		?><p class = "message">The file <?php echo $pic4;?> has been uploaded, and your information has been added to the directory</p><?php
	}else{
		?><p class = "message">Sorry, there was a problem uploading <?php echo $pic4;?>.</p><?php
	}
}
if($pic5!=""){
	if(move_uploaded_file($_FILES['photo5']['tmp_name'], $target5)&&chmod($target5,0664))
	{
		?><p class = "message">The file <?php echo $pic5;?> has been uploaded, and your information has been added to the directory</p><?php
	}else{
		?><p class = "message">Sorry, there was a problem uploading <?php echo $pic5;?>.</p><?php
		}
	}

//This gets all the other information from the form
$articleTitle=$_POST['articleTitle'];
$articleAuthor=$_POST['articleAuthor'];
if($pic !=""){
$articleImage=$pic;
}else{
$articleImage=$_POST['articleImage'];
}
if($pic2 !=""){
$articleImage2=$pic2;
}else{
$articleImage2=$_POST['articleImage2'];
}
if($pic3 !=""){
$articleImage3=$pic3;
}else{
$articleImage3=$_POST['articleImage3'];
}if($pic4 !=""){
$articleImage4=$pic4;
}else{
$articleImage4=$_POST['articleImage4'];
}if($pic5 !=""){
$articleImage5=$pic5;
}else{
$articleImage5=$_POST['articleImage5'];
}


$query = "UPDATE articles SET
articleTitle = '{$articleTitle}',
articleImage = '{$articleImage}',
articleImage2 = '{$articleImage2}',
articleImage3 = '{$articleImage3}',
articleImage4 = '{$articleImage4}',
articleImage5 = '{$articleImage5}',
articleAuthor = '{$articleAuthor}',
articleDate = '{$articleDate}',
articleFeatured = '{$articleFeatured}',
articleIntroText = '{$articleIntroText}',
articleContent = '{$articleContent}',
articleCategory='{$articleCategory}',
articleCaption='{$articleCaption}',
articleCaption2='{$articleCaption2}',
articleCaption3='{$articleCaption3}',
articleCaption4='{$articleCaption4}',
articleCaption5='{$articleCaption5}'
WHERE articleID = $articleID";
$result = mysql_query($query);
if(mysql_affected_rows()==1){
	// Success
	$message = "The article was successfully update";
}else{
	// Failed
	$message = "The article update failed";
	$message .= "<br />" . mysql_error();
}
if($articleFeatured == 1){
	featuredArticle();						
}

}
  
$result = mysql_query( "SELECT * FROM articles WHERE articleID = '$articleID'") 
or die("SELECT Error: ".mysql_error()); 
$row = mysql_fetch_array($result);
?>
  <section>
    <h2>Edit This Article</h2>
    <?php if(!empty($message)){echo "<p class =\"message\">" . $message . "</h3>";} ?>
    <?php if(!empty($errors)){display_errors($errors);}?>
     <form method="post" action="editArticleDetails.php?article=<?php echo $articleID; ?>" enctype="multipart/form-data">

      <h3> Article Title: </h3>
      <input type="text" name="articleTitle" value="<?php echo $row['articleTitle'];?>"size="60"/>
      
      <h3> Article Image name: </h3>
      <?php if($row['articleImage'] != ""){ ?>
      <input type="text" name="articleImage" value="<?php echo $row['articleImage'];?>" size="60"/>
      <img src="../_images/_<?php echo $row['articleCategory'];?>/<?php echo $row['articleImage'];?>" width="480">
      <h3>Upload New Image</h3>
      <?php } ?>
      
      <input type="hidden" name="size" value="350000">
      <input type="file" name="photo">
      
      <h3> Please Enter a Caption for the image here: </h3>
      <input type="text" name="articleCaption" value="<?php echo $row['articleCaption'];?>" size="60"/>
      <h3> Article Author: </h3>
      <input type="text" name="articleAuthor" value="<?php echo $row['articleAuthor'];?>" size="60"/>
      <h3> Article Date: </h3>
      <input type="text" name="articleDate" value="<?php echo $row['articleDate'];?>" size="60"/>
      <h3> Article Featured: </h3>
      <input type="radio" name="articleFeatured" value="0" 
		<?php if($row['articleFeatured'] ==1){ echo " checked";} ?> />
      Yes 
       
      <input type="radio" name="articleFeatured" value="1" 
            <?php if($row['articleFeatured'] ==0){ echo " checked";} ?>/>
      No
      <h3> Please choose a category </h3>
      <select name="articleCategory">
        <option value ="<?php echo $row['articleCategory'];?>" selected="selected" ><?php echo $row['articleCategory'];?></option>
        <option>news</option>
        <option>humaninterest</option>
        <option>sports</option>
        <option>columns</option>
        <option>letters</option>
        <option>marriages</option>
        <option>engagements</option>
        <option>obituaries</option>
      </select>
      <h3>
      <h3> Please Enter the intro text for the article: </h3>
      <textarea name="articleIntroText" cols="60" rows="10" class="mceIntro"/>
      <?php echo $row['articleIntroText'];?>
      </textarea>
      <h3> Article Content: </h3>
      <textarea name="articleContent" cols="60" rows="20" class="mceEditor"><?php echo $row['articleContent'];?></textarea>
      <h3> Related Image 1: </h3>
      <?php 
      if($row['articleImage2'] != ""){ ?>
      <input type="text" name="articleImage2" value="<?php echo $row['articleImage2'];?>" size="60"/>
      <img src="../_images/_<?php echo $row['articleCategory'];?>/<?php echo $row['articleImage2'];?>" width="480">
      <h3>Upload New Image</h3>
      <?php } ?>
      <input type="hidden" name="size" value="350000">
      <input type="file" name="photo2">
      <h3> Please Enter a Caption for the image here: </h3>
      <input type="text" name="articleCaption2" size="60" value="<?php echo $row['articleCaption2'];?>"/>
      <h3> Related Image 2: </h3>
      <?php if($row['articleImage3'] != ""){ ?>
      <input type="text" name="articleImage3" value="<?php echo $row['articleImage3'];?>" size="60"/>
      <img src="../_images/_<?php echo $row['articleCategory'];?>/<?php echo $row['articleImage3'];?>" width="480">
      <h3>Upload New Image</h3>
      <?php } ?>
      <input type="hidden" name="size" value="350000">
      <input type="file" name="photo3">
      <h3> Please Enter a Caption for the image here: </h3>
      <input type="text" name="articleCaption3" value="<?php echo $row['articleCaption3'];?>" size="60"/>
      <h3> Related Image 3: </h3>
      <?php if($row['articleImage4'] != ""){ ?>
      <input type="text" name="articleImage4" value="<?php echo $row['articleImage4'];?>" size="60"/>
      <img src="../_images/_<?php echo $row['articleCategory'];?>/<?php echo $row['articleImage4'];?>" width="480">
      <h3>Upload New Image</h3>
      <?php } ?>
      <input type="hidden" name="size" value="350000">
      <input type="file" name="photo4">
      <h3> Please Enter a Caption for the image here: </h3>
      <input type="text" name="articleCaption4" value="<?php echo $row['articleCaption4'];?>" size="60"/>
      <h3> Related Image 4: </h3>
      <?php if($row['articleImage5'] != ""){ ?>
      <input type="text" name="articleImage5" value="<?php echo $row['articleImage5'];?>" size="60"/>
      <img src="../_images/_<?php echo $row['articleCategory'];?>/<?php echo $row['articleImage5'];?>" width="480">
      <h3>Upload New Image</h3>
      <?php } ?>
      <input type="hidden" name="size" value="350000">
      <input type="file" name="photo5">
      <h3> Please Enter a Caption for the image here: </h3>
      <input type="text" name="articleCaption5" value="<?php echo $row['articleCaption5'];?>" size="60"/>
      <p><input type="submit" name="submit" value="Edit Article" /></p>
    </form>


This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.