Array Query - For Adding Alt Text To Multiple Image Upload Form
I've set up a form for uploading multiple images and I am writing the urls to a database, which is queried and outputs the images on a web page. This works fine, however, I also want to add alt/title text for each image upload but can't quite seem to get it working. I'm pretty new to PHP so my knowledge of how to use arrays is fairly limited. Code:
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
Adding Image Upload Facility To An Entry Form
I've been building a test version of an on-line local business directory. (using php and mysql) It's going really well (especially as I'm still a beginner really). So far I've got some information in my database, a search page, master listing, admin area for editing the information and I've also created a page for adding new entries to the database. So far it's all working very well but I would like to make an addition... On the page where you can add new entries to the database, one of the text fields is for an image url. I'd like to be able to change this to an option that would let you upload in an image from your computer to the server, and take the location of the image on the server and put that in the database.
Adding Image Next To Text
I read and understood the tutorial for "Quick and dirty PHP/MySQL" publishing system. However after trying hard to find a way to add an imageurl next to the text, it just seem to be impossible. It only shows the url next to the written stuff, so I am looking for a string/code which converts the URL to show the image. I have also tried using a BBcode string in the script but it didn't work either. I know it's a simple thing but it has kept me up for 5 days now.
Adding Files For Ftp Upload To A Php Form
Does anyone know of a way to add the option for a "image" or "file" upload to ftp server using PHP? In this case it would be for images that are on my site that users could change. Not looking to import them into a database though. I'm familiar with form postings - just not giving a user the option to add a file for upload.
Multiple Image Upload
I've made this single image uploader using a tutorial, basically I want to adapt so it uploaded multiple images in one go. I've seen quite a few scripts online for multi-image uploaders but I'm quite curious if what I'm trying to do is possible with this script.. Code:
Upload Multiple Image Problem
Thumbnail Image File: <input type="file" name="proj_thumb_image"> Fullsize Image File:<input type="file" name="proj_full_image"> On the form Action page (where the form contents are handled) I have place the following code echo "<p>Thumb temp file name: ".$_FILES['proj_thumb_image']['tmp_name']."</p>"; echo "<p>Full temp file name: ".$_FILES['proj_full_image']['tmp_name']."</p>"; I get a real name for $_FILES['proj_thumb_image']['tmp_name'] but I get 'none' for $_FILES['proj_full_image']['tmp_name']. I have a feeling this is going to be one of those 'DOH' moments.
Upload & Query MySQL Info Database With Image Files
I want a database I can enter information and upload a photo from a web form. Then I want to query that database for the text info with its related photo and display it (formatted) in a browser (html). Summary: 1. upload photo's and text information to database with my add article form. 2. Query the database and page the results with the text and related photo. It comes in three parts: 1. add_article.php [Text / Photo Upload Form] 2. insert_article.php [Inserts into database] 3. articles.php [View Output] Here is what I have this far:
Multiple File Upload With Out Form
From my remote websites admin system, I would like to be able to select a folder on the local computer and upload every file in the selected folder up to the remote site. I don't want to use form file uploads. I want the user to be able to nominate a local folder and the whole folder is copied with one click of a button. Is this possible to do with out putting the user through any complexx procedures.
Image UPLOAD Form
I got the image upload to work and upload to a direvtory on my server but the other information on the form is not dealt with and since I can not use this: PHP Code:
File Upload From A Form / Upload_tmp_dir Query
I want to allow file uploads to the server without exposing the non-technical end-users to FTP settings, file naming protocols, etc. I've found the following from http://www.zend.com/manual/features.file-upload.php .... HTML FILE (uploadtest.html) <form enctype="multipart/form-data" action="uploadtest.asp" method="POST"> Send this file: <input name="userfile" type="file"> <input type="submit" value="Send File"> </form> PHP FILE (uploadtest.php) <?php // In PHP earlier then 4.1.0, $HTTP_POST_FILES should be used instead of // $_FILES. In PHP earlier then 4.0.3, use copy() and is_uploaded_file() // instead of move_uploaded_file $uploaddir = '/var/www/uploads/' $uploadfile = $uploaddir. $_FILES['userfile']['name']; print "<pre>"; if (move_uploaded_file($_FILES['userfile']['tmp_name'], $uploadfile)) { print "File is valid, and was successfully uploaded. "; print "Here's some more debugging info:"; print_r($_FILES); } else { print "Possible file upload attack! Here's some debugging info:"; print_r($_FILES); } print "</pre>"; ?> END OF CODE I select a file to upload and the delay in submitting the form suggests that the file has been sent. But I always get the "possible file upload attack" result. The file info shows the correct filename and type but the filesize is always .. and the 'tmp_name' is always 'none'. Assuming this was the problem I did some digging using phpinfo(). The version is 4.1.2 so I seem to be using the right commands as per the instructions with the code. But the 'upload_tmp_dir' variable is NOT SET which I think might be the problem. So, with apologies for taking so long to get here, I have two queries... 1) Is there anything wrong with the code I'm using? 2) Where do uploaded files go if 'upload_tmp_dir' is not set and how can I bypass this without access to the server (shared hosting)
Image Upload & Email Form
I have attempted to hack together an email attachments script with an image upload script. My overall goal is to let users visit my site and upload a picture and caption. However, I don't want it posted directly to the site, I would like it emailed to me so I can review it first.
Form With Multiple Image Inputs
I have a problem that I cannot seem to find a solution. I'd appreciate any insight on it. I have a form with inside a dynamically created table of Images and 3 inputs of type image: echo "<form method=post action='http://localhost/processplay.php?$counter' >"; echo "<table align=center border=10>"; $counter = 1; for($i=0;$i<5;$i++) { echo "<tr>"; ..... echo "<img src=$source width=30 height=30>"; ...... echo echo "<input name=$counter type=image height=30 width=30 src=$source>" ...... ..... How can I pass to the processplay.php (the action of this form) which input was pressed? (remember that the name of the input is unknown to me before the form is created so I cannot write it explicitly).
Image Won't Upload - I've Checked Form A Dozen Times
which is supposed to upload an image. I expect the image name as a var to be $uploadedFile. In the receiving function, I've this code: global $uploadedFile, $uploadedFile_size, $uploadedFile_name; echo "here is the file name: $uploadedFile, $uploadedFile_size, $uploadedFile_name; <hr> "; $uploadedFile_name = $formatTextObject->processFileName($uploadedFile_name); $uploadedFile_name = htmlspecialchars($uploadedFile_name); The line where I echo things out is just for debugging. I get the first 5 words, but no vars, nothing, no globals of that name are in global space. Below is the form. What am I missing? [color=blue][color=green][color=darkred] >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>[/color][/color][/color] <form method="post" action="/mcControlPanel.php" enctype="multipart/form-data" class="mcForm"> <input id="inputId1" type="hidden" name="formInputs[formSecurityRating]" value="associate" class="hiddenInput"> <div class="formElement"> Upload an image: <input type="file" name="uploadedFile"><input type="hidden" name="uploadType" value="image"></div> <div class="formElement"> Type an easy to read name (as opposed to the file name) for this image: <div class="inputBoxTitle"><input id="inputId2" type="text" name="formInputs[cbHeadline]" value="" class="textInput"> </div></div> <div class="formElement"> Type a brief description:<br> <textarea id="inputId3" name="formInputs[cbMainContent]" class="textareaInput"></textarea> <p>HTML into symbols? <input type="checkbox" name="formInputs[usingHtml]" value="y" class="textareaCheckbox"></p> </div> <input type="hidden" name="formInputs[cbWhichType]" value="imageInfo"> <input type="hidden" name="choiceMade" value="standardImageUpload"> <input type="hidden" name="fileName" value=""> <input type="submit" value="Click here when done" class="submitInput"> </form></div>
Using A Array In An Upload Form
I have a drynamic upload form that uses an array as the field name so it's something like image[2] that didn't seem to be working so i switched to something like image2 the problem is when im getting it in i have to see which ones a file so i do something like if(isset($_FILES[image$i])){ } where $i equals the current number. This leads to an error as you might know, and i was just woundering if there was anyone who knew of a better way to do this.
Upload Image Via Form And Resize And Save Link In MYSQL
I am using a simple php script shown below to add data into mysql.I need to upload several pics sometimes one or sometimes up to 5 and resize them if they to big to a specfic size. Then save either the image in the DB or to a folder and save the link in the DB so i can recall it in a set of image tabs... Also if possible to make a thumb which is used for the link and then when u click it a bigger pic appears PHP Code:
Multiple Values In A Form - Array
So the problem is: I have a form wich passes some values to a new page, the problem is the filed name is ever the same but the values changes. But the value passed is always the last one. PHP Code:
Form: How To Read Array From Select-multiple
<form method="get"> <select name="users" multiple> <option value="peter">peter</option> <option value="paul">paul</option> </select> <input type="submit" value="select"> </form> When I select both the string behind the URL is: ?users=peter&users=paul How do I read BOTH variables?
Php Generated Form Array And Formatting For Mysql Query
As part of a form I have created I have a MySQL generated table who's fields include soccer team names, opponents, next match date, matchid etc. . Each row has a check box with the value of the checkbox being the unique row ID in the MySQL table (match id). When a user selects the teams from the list he would like more information about, the checkbox variable is parsed to the script as an array "$var[]". If I use the following code, I can see all the contents of the $Var array that has been parsed to the script. [php <? $number=count($var); for($a=0;$a<=$number;$a++){ echo $var[$a]; } ?> /php] The problem is how do I format the above output so that I can include it in a MySQL query statement? I have no way of knowing how many teams have been selected or the key index number for each variable in the array. How do I code this so that each row matchid is assigned it's own unique varable such as team 1, team2 etc? I was thinking of using a loop to go through the array and generate $var appended with a number using the the PHP count() function. but seeing that I am fairly new to PHP I'm not sure if this will work or where to start!
Submitting Multiple Form Fields In An Array / Loop
I have the following form <FORM NAME="form1" METHOD="POST"> <?php do { ?> <input name="approve[]" type="checkbox" id="approve[]" value="<?php echo $row_rs['ID']; ?>"> <select name="select"> <option value="1">option 1</option> <option value="2">option 2</option> <option value="3">option 3</option> </select> <?php } while ($row_rs = mysql_fetch_assoc($rs)); ?> </FORM> I want to acheive a loop that inserts a record into a database that enters the id and the value they have selected (if the approve input box was ticked) so far I have this: <? foreach($approve as $aID) { $insertSQL = "INSERT INTO TABLE('refID','optionSelected') VALUES ('$aID','')"; } ?> How do I enter the select value within this loop? I assumed that it would be just $insertSQL = "INSERT INTO TABLE('refID','optionSelected') VALUES ('$aID','$select')";
Quickly Adding Text To A Mysql Text Field That Is NOT Empty
Is there a way to insert text into a mysql text field that already has text into it; without having first to extract the existing data and append the new text to that string variable and then insert the new string. Basically i'm looking for a way to do it with a single query not 2 (one being a select to gather existing data).
Adding Text To Text Window With A Button
I have made an admin section of a site, What i want to do i have buttons under that have "BOLD" "center" and when clicked it adds <b></b> tags to the text area etc etc.. if the text area was called "message" how would i going about coding the images / buttons to add the code?
Adding SUM To Query
I have a SELECT * query that returns info such as 'name', 'date', 'cost', and 'notes'. At the head of this query return it reads how many records were found. I would like to append that with 'how many records were found at a cost of' ... But haven't been able to find a means of totalizing the 'cost' column in my query. Does anyone have any ideas on how this might be accomplished ??? I've spent considerable time on the net looking at examples and my reference book but so far, no luck.
Modify Image Upload Scripy To MP3 Upload Script
I am using the following script to upload images to a database. I am pretty new to PHP, but what I would like to do is, modify the script so that it handles MP3 uploads instead of image uploads. Is that possible with this script? If so, has anyone got any ideas how I would go about it? Code:
Adding Query Strings
How do you put the strings after an url together. e.g. the url is already: http://something.com/index.php?id=2 and a link is going to change it to index.php?id=2&order=4
Adding Strings To A Query String?
I want to use my string $stringvar to show text in this sql query. ATM its sticking "$player, $score" into a field, I want it to instead print it out into the sql statement. This is my code: $stringvar="$player, $score"; $sql=mysql_query("INSERT INTO $game_db VALUES ('$new_matchid', '$opponent', '$map', $stringvar, '$result')"); This is what I want the sql query thing to look like: $sql=mysql_query("INSERT INTO $game_db VALUES ('$new_matchid', '$opponent', '$map', $player, $score, '$result')");
Adding Text To Variable
I have an email login screen that sends the username and password to an authentication screen. I designate the username with the name of the input, i.e. <input type="text" name="username"> with 'user' entered sends $username=user to the php authentication page. The problem is, to log in, users have to enter 'user+domain.com' in the user name (ISP requirement). Is there a php script I can add to the login page so that a user can just type their user name and the code will automatically add '+domain.com' to the end of it and send it as $username=user+domain.com?
Adding Text On Images
i want to add the text to my images. here is my code but it is adding the text to only first image(horses.jpg) and displaying that image. this is my code.i want to add www.abc.com on both images. any of your idea will be appreciated.please find where iam wrong. Code:
Adding Multiple Entries With One Click
I've written a form in html and use php to process it to my database. What I want to do is make it so that a person can choose a number and then by clicking submit it will create an amount of db entries that corresponds to the number that they chose.
Adding Values In One Column From Query Results
I have this query: SELECT *, sum(field_value) as totalValue FROM table_name WHERE field_id = $id GROUP BY field_group the data type of field value is a decimal value, with values such as 125.00 and 150.50 stored in each record. My goal is to have totalValue be the total value of those numbers. So if I have two records that equal 125.00 and 150.50 totalValue would = 175.50. the above query does not do this. What do I need to change here? Should I try to do this from the PHP side?
Pdflib Adding An Image
I am trying to create a pdf using pdflib in php which includes some text and an image. however, the part that loads the image seems to keep failing. the code: <?php $mypdf = PDF_new(); pdf_open_file($mypdf, "this_is_it.pdf"); pdf_begin_page($mypdf, 595, 842); $myfont = PDF_findfont($mypdf, "Times-Roman", "host", 0); pdf_setfont($mypdf, $myfont, 10); pdf_show_xy($mypdf, "Sample PDF, constructed by PHP in real-time.", 50, 750); pdf_show_xy($mypdf, "Made with the PDF libraries for PHP.", 50, 730); $myimage = pdf_load_image($mypdf,"jpeg","test.jpg",""); pdf_fit_image($mypdf, $myimage, 390,575, ""); //place image within page coordinates pdf_close_image($mypdf, $myimage); PDF_end_page($mypdf); PDF_close($mypdf); PDF_delete($mypdf); ?> the error:
Adding A Image Tint
Is there a way by which a tint of color can be added to my images dynamically... Like say blue tint to the whole image. or a green color tint.
Adding Multiple Listbox Items To Mysql
I want to be able to select multiple items from a listbox in a form and send the result to mysql blob. I only get one item to the bd. Here is part of the script. Item: <select name="itm" align="bottom" multiple size="2"> <option value="item1">item1</option> <option value="item2">item2</option> <option value="item3">item3</option> <option value="item4">item4</option> <option value="item5">item5</option> </select> "Insert into xyz set itm = '$itm'";
Adding Multiple Rows To Table Using Checkboxes
I'm looking to select using checkboxes certain rows from the results of 'table a' and add the selected rows to another table using checkboxes. I Have had limited success adapting some code for deleting multiple records using checkboxes. Code:
Image Upload Problem - New Image Not Displaying
I have a consistent problem that needs knocking on the head. I have an image upload script that uploads an image and replaces the old image. The image that is displayed is sometimes that old image and the page must be manually refreshed to get the new one. I need the new image to be displayed with out have to manually refresh the page. So far I have identified the following: • Ive been testing in ie and firefox – the problem only happens in firefox. • If the upload script is activated more than once it works as desired – but not the first time. I need it to work the first time. • I have set the page to automatically refresh. – this works in ie, but firefox still needs a manual refresh. • I’ve included the following which makes no difference: • header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); • header("Cache-Control: no-cache"); • header("Pragma: no-cache");
Adding Array Value
I need to find if 2 array contains same value, if so then add their count values. For example, I have the below array. I have to add 'count' of array 0 and array 1 because the 'url' is the same (open). I have to also add 'count' of array 2 and array 3 because the 'url' is the same. Code:
Adding To An Array
You know how you can do this: array("#ff0000","#ff8800","#0022ff","#33ff33") Well how could i set it up so that in a while statement it adds to the array? And if its possible how can i make it add a random color (#ff0000 etc.); Any ideas?
Upload Form And Upload Script On Same Page
On many upload pages, the FORM action is set to the same page-that means the script to generate the page and save the uploaded files is same.Can somebody give me some simple example of how to do this ? How to detect if somebody is accessing a page( == generate the form) or uploading the files ( == upload the files) ?
Adding Onto Array Login.
I have a login screen (login.html) that posts to login.php which confirms if the username is valid or not then redirects them to welcome.php. Without making a cookie, is there anyway I can maintain the username they typed in and use it in welcome.php? I tried doing anther form action = "welcome.php" in the login.php page with no luck. Maybe I am just doing it wrong...help? It can be viewed here.
Adding Values To An Array
i have an array that gets filled by users hitting a FAVORITE button on 'product' pages. I can get one value, but the value doesn't stay after the page has refreshed... so i think I need to use Sessions but I have tried before and have always been unsuccessful... here is the code that displays the favorite product. PHP Code:
Adding Data To An Array
I'm trying to make a simple shopping basket script, but am a little unsure of the best way to do it. I want an array where items can be added/removed with a simple form and displayed as a list, but I'm a little unsure how to go about doing it. Code:
Adding To Multidimensional Array
I'm realtively new to PHP and I'm trying to get my head around a particular issue. I've got an array that looks like this: $field_array = array ( array (field=>"dist_Company", type=>"text"), array (field=>"dist_Active", type=>"select", options=>array(array(oname=>"yes", oval=>"1"), array(oname=>"no", oval=>"0"))), array (field=>"dist_CompanyID", type=>"select"), array (field=>"dist_Shipping", type=>"text") ); What I'm trying to figure out is how to add to this array after it's been defined. In this case I'm trying to add the "options" subarray to dist_CompanyID element so that it has options similar to those predefined in the dist_Active element. I can do it if I specify the index like this: $field_array[2]['options'][] = array(oname=>"one", oval=>"1"); $field_array[2]['options'][] = array(oname=>"two", oval=>"2"); $field_array[2]['options'][] = array(oname=>"three", oval=>"3"); Is there some elegant way to find the index number for the element containing field=>"dist_CompanyID"?
Adding To Form?
novice with mysql so be slow. Want to be able to update the contents of a database row through a form, i want to be able to load the contents of a specific row my database table is as follows id(pk) | title | body | date(text field) --------------------------------------------------------------------------- 1 | hello | test | 15-11-2006 13:44 2 | again | test2 | 15-11-2006 13:45 basically i want to be able to add the contents of one of thw rows into various forms, for instance lets say i want to edit all of the stuff in the table which i do, and i want to add the title and the body into forms respectively named title and body how would i do this? I tried using a select statement to select all of the items from the table in the database and put where id='".$id."' Basically i dont have a clue wehre to start here
Adding Values Onto An Associative Array...
I'm trying to develop a simple class which through the interface you can add elements to an array. The method I have used to add the elements is setContentFields($name, $field_type), I have used an array counter variable to increment the array index each time. To me this seems like a workaround, and I wondered if there was a more elegant way of doing this. The class is as follows:
Adding Sums Of Array Values
I have two arrays: ('a'=>1,'b'=>3,'c'=>2,'d'=>6) ('a'=>2,'b'=>0,'c'=>4) I need a very efficient function to add the values together for each element. For instance, the output would be an array: ('a'=>3,'b'=>3,'c'=>6,'d'=>6) This function could potentially be used in billions of iterations, so it needs to be as efficient as possible.
Adding Only Unique Items To An Array
I've made a small code snippet that adds a new item ($value = $_GET) to an array in a cookie. My main question is in the title of the post, and I have a related one: How do I delete a specific value from the array and shift all the other values down to fill its place? Will this happen on its own? And one more: Using this code I display the array values in descending order; foreach ($_COOKIE['best'] as $name => $value) { $best = urlencode($value); echo //insert code here } } Is there any way to display this in ascending order?
Adding Values To A Superglobal Array
i have a variable (well, an Object) which is needed in beneath every Script. it's not needed to be changed during the whole script, so i like to access it easyli without passing by or declare it as global in every function. afaik it isnt possible to set a variable to superglobal. Is there any reason why i shouldn't add it to the _SERVER array or any other superglobal?
|