Jump to content

tunedin

New Members
  • Posts

    6
  • Joined

  • Last visited

tunedin's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Ok so I have been adding an image upload form with a seperate upload thumbnail, that works great. The problem is now that I have added captions to the images I am receiving this error. [caption1] => Caption Text Test [caption2] => [caption3] => [caption4] => [caption5] => [caption6] => [caption7] => [insert] => Insert Article ) [b]Notice[/b]: Undefined index: caption8 in [b]images_upload.php[/b] on line [b]9[/b] Here is the images_upload.php is line 9. <?php $uploader = new Zend_File_Transfer_Adapter_Http(); $uploader->setDestination($destination); $uploader->setOptions(array('ignoreNoFile' => TRUE)); $files = $uploader->getFileInfo(); $filenum = 1; foreach ($files as $file => $info) { $file = "photo{$filenum}"; $caption = $_POST["caption{$filenum}"]; if (isset($_POST["article_id{$filenum}"])) { $article_id = $_POST["article_id{$filenum}"]; } else { $article_id = NULL; } And here is the insert_images.php form I am using to insert the data. The thumbnails use a different script which resembles the images, with variables changed. It workes great, especially before I added captions to the mix, and inserts all data accordingly. I am just puzzled as to why I am getting this error. <?php for ($e = 1; $e <= $thumbfields; $e++) { ?> <p> <label for="thumbnail<?php echo $e; ?>">Thumbnail:</label> <input type="file" name="thumbnail<?php echo $e; ?>" id="thumbnail<?php echo $e; ?>" /> </p> <?php } ?> <?php for ($i = 1; $i <= $photofields; $i++) { ?> <p> <label for="photo<?php echo $i; ?>">Photo <?php echo $i; ?>:</label> <input type="file" name="photo<?php echo $i; ?>" id="photo<?php echo $i; ?>" /> </p> <p> <label for="caption<?php echo $i; ?>">Caption for photo <?php echo $i; ?>:</label> <input value="<?php if ($_POST && $errors) { echo htmlentities($_POST["caption{$i}"], ENT_COMPAT, 'UTF-8'); }?>" type="text" name="caption<?php echo $i; ?>" id="caption<?php echo $i; ?>" /> </p> <?php } ?>
  2. Array ( [name] => Testing [description] => Testing [link1] => Test1 [category_id1] => FD [link2] => Test2 [category_id2] => FD [insert] => Insert Video) The name and description fields are two other fields on the page to fill out properlly. But those aren't in a loop. I get unidentified index for both link and category_id. So how can I go about's fixing this?
  3. What would be the correct way to insert two text field to the same table? I would like that if no information is typed in the link field or select a category that it doesn't create a new row. Any help would be appreciated!
  4. Actually sorry about that, as that is it doesn't post at all. I get undefined index for both link and category_id, and get integrity constraint for column link cannot be null.
  5. As it is right now it only posts the last selection, whether it has text inserted or not.
  6. Hello all, I have been trying to figure this out for the past couple days and can't seem to find the correct solution. I have two fields: 1) Text field 2) Select Menu (which is pulling selections from db table categories) categories: 1)category_id 2)category_name What I want to do is display these fields twice (which I have set up), and be able to post this loop into the db table: videos: 1)video_id 2)link 3)category_id Not every post will have a video link associated with it, but some may have a maximum of 2. Here is the code as is for Post.php <?php for ($i= 1; $i<= $videofields; $i++) { ?> <p> <label for="link<?php echo $i; ?>">Video Link<?php echo $i; ?>: </label> <input value="<?php if ($_POST && $errors) { echo htmlentities($_POST["link{$i}"], ENT_COMPAT, 'UTF-8'); }?>" type="text" name="link<?php echo $i; ?>" id="link<?php echo $i; ?>" /> </p> <p> <label for="category_id<?php echo $i; ?>">Select Catgegory<?php echo $i; ?>:</label> <select name="category_id<?php echo $i; ?>" id="category_id<?php echo $i; ?>"> <option value="0">-- Select Category --</option> <?php foreach ($categories as $row) { echo "<option value='{$row['category_id']}'"; if ($errors && $_POST["category_id{$i}"] == $row['category_id']) { echo 'selected="selected"'; } echo ">{$row['category_name']}</option>"; } ?> </select> </p> And here is the definitons.php $data = array('link' => $_POST['link'], 'category_id' => $_POST['category_id']); $dbWrite->insert('videos', $data); Any help would be greatly appreciated!
×
×
  • 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.