PHP - Beginner: Explode Array Into Multidimensional Array
Hi, I'm trying to explode an array into a multidimensional array using <br /> tags as splitters but just can't get the syntax right! I can do lines of the array one by one, but not the whole lot at once. I'd really appreciate a quick example of an explode inside an array.
$myarray looks something like this with print_r: ( [0] => [1] => some_html<br />some_html<br />some_html<br /> [2] => some_html<br />some_html<br />some_html<br /> [3] => some_html<br />some_html<br />some_html<br /> ) and I want to turn it into this: ( [0] => [1] => [0]some_html [1]some_html [2]some_html [2] => [0]some_html [1]some_html [2]some_html [3] => [0]some_html [1]some_html [2]some_html ) I've tried this $myarray = explode ("<br />", $myarray); but it doesn't work … It doesn't matter too much if there's are a few empty lines in the array from the final <br /> tags. Many thanks, as ever, for any help. Similar TutorialsI have the following array structu Code: [Select] [0] => Array ( [id] => Array ( [$t] => http://www.google.com/mate/ ) [updated] => Array ( [$t] => 2011-08-31T11:43:05.942Z ) [category] => Array ( [0] => Array ( [scheme] => http://schemas.google.com/g/ [term] => http://schemas.google.com/contact/ ) ) [title] => Array ( [type] => text [$t] => Name ) [link] => Array ( [0] => Array ( [rel] => http://schemas.google.com/contacts/2008/rel#edit-photo [type] => image/* [href] => https://www.google.com/mate/feeds/photos/media/ ) [1] => Array ( [rel] => self [type] => application/atom+xml [href] => https://www.google.com/mate/feeds/contacts ) [2] => Array ( [rel] => edit [type] => application/atom+xml [href] => https://www.google.com/mate/feeds/ ) ) [gd$email] => Array ( [0] => Array ( [rel] => http://schemas.google.com/g/2005#other [address] => email_address@gmail.com [primary] => true ) ) ) I am tried to display name and email address. I am using following method, can anyone tell me is there any better way? Thank u 4u help. NAME $name=( $emp_det[0]['title'][t]); $email =( $emp_det[0]['gdemail'][0][address]); I am trying to store all the elements of my tree in an array.My code produces multi dimensional array, but i want it to be one dimensional. How can i get it ? Code:- Code: [Select] function tree_gather($node) //Function to calculate count { $sql = "SELECT lchild,rchild FROM tree WHERE parent = '$node'"; $execsql = mysql_query($sql); $array = mysql_fetch_array($execsql); if(!empty($array['lchild']) || !empty($array['rchild'])) { $child[] = $array['lchild']; $child[] = $array['rchild']; $child[] = tree_gather($array['lchild']); $child[] = tree_gather($array['rchild']); } return $child; } Result:- Code: [Select] Array ( [0] => 2 [1] => 3 [2] => Array ( [0] => 4 [1] => 5 [2] => Array ( [0] => 10 [1] => 11 [2] => [3] => ) [3] => Array ( [0] => 8 [1] => 9 [2] => [3] => ) ) [3] => Array ( [0] => 7 [1] => 6 [2] => Array ( [0] => 15 [1] => 14 [2] => Array ( [0] => 16 [1] => 17 [2] => [3] => ) [3] => ) [3] => Array ( [0] => 13 [1] => 12 [2] => [3] => ) ) ) Table: - Hi all! This is probably fairly simple for someone who is used to dealing with arrays. I have an array of data(Parsed from an XML document) containing a string I would like to further split into another array. The string is along the lines of: "<name>":<value>,"ID":20251,"ID2":2300,"ID3":2000 How can I split the above into: Array[<NAME>] => <VALUE> Notes: <name> changes often. depending on the query, it may have different <name> values. I have been trying to do it with preg_split and got to: Array ( => "<NAME>":<VALUE> [1] => "ID":20251) but I need to split it further at ":". I tried a foreach, but I failed miserably. Can anyone point me in the direction of better practice for arrays/preg_split? I have looked into the PHP documentation, but it is not enough for me. Thanks in advance I have in ONE MySQL database row a string of ID's like this: Name of Row: Values: Post IDs 10 14 52 37 And now I want to fetch those ID's explode them (by the space) and then use them as an array, like this: $array[] = explode(" ", $query); echo $array[0]; // 10 echo $array[1]; // 14 echo $array[2]; // 52 Is this possible, if yes how can I do this? I have a form that saves the input data as such: Quote bass inshore offshore Array, regional, mid, 70, 40, 2 x yr, all, fellowship knowledge information learnig, one, one, three, four, one, one, two, three, three, four, TPWD round table discussions conservation biology, the guide talking about fishing the venturi, Jack Ellis and TAG fishing in the East Texas creeks., none at present bass inshore offshore Array, regional, mid, 70, 40, 2 x yr, all, fellowship knowledge information learnig, one, one, three, four, one, one, two, three, three, four, TPWD round table discussions conservation biology, the guide talking about fishing the venturi, Jack Ellis and TAG fishing in the East Texas creeks., none at present bass inshore offshore Array, regional, mid, 70, 40, 2 x yr, all, fellowship knowledge information learnig, one, one, three, four, one, one, two, three, three, four, TPWD round table discussions conservation biology, the guide talking about fishing the venturi, Jack Ellis and TAG fishing in the East Texas creeks., none at present This php program reads it back to the screen as it is writen and as you see it above. Code: [Select] <?php $YourFile = "meeting.survey"; $handle = fopen($YourFile, 'r'); while (!feof($handle)) { $Data = fgets($handle); print $Data; print "<hr>"; } fclose($handle); ?> The code below fails. I feel it is because I am using 'explode' incorrectly. Code: [Select] <?php $YourFile = "meeting.survey"; $handle = fopen($YourFile, 'r'); while (!feof($handle)) { $Data = fgets($handle); $answers = explode(',', $Data); print $answers[0]; print $answers[1]; print $answers[2]; print $answers[3]; print $answers[4]; print $answers[5]; print $answers[6]; print $answers[7]; print $answers[8]; print $answers[9]; print $answers[10]; print $answers[11]; print $answers[12]; print $answers[13]; print $answers[14]; print $answers[15]; print $answers[16]; print $answers[17]; print $answers[18]; print $answers[19]; print $answers[20]; print $answers[21]; print "<hr>"; } fclose($handle); ?> My PHP coding skills are minimal at best, any help, direction, comments you have will be greatly appreciated. If you wish to view the survey html go here If you wish to view the php code used to produce the data, Code: [Select] wget http://texasflyfishers.org/quiz/php_tutorial/survey.php If you wish to view a readback of the data go here Everything I've been able to find over the web, tells me this is what I need to do if I want to add some text that tells what each responce means. I have strings that can look like this "monkeys / cats/ dogs / snakes". I have code that breaks the items apart and puts each as a separate item into an array, like this (where $getstring['thestring'] equals strings like the example given above)... Code: [Select] $array = explode("/", strtolower(trim($getstring['thestring']))); foreach($array as $k=>$v) { $array[$k] = trim($v); } } My question is how can I add some code so that if there are ever instances where there is nothing between each /, it does NOT put that "blank" into the array? For example, if a string was something like "monkeys / cats/ / dogs/ eagles / / snakes", the code now would create two array items that are essentially "blank" because there were two consecutive slashes, two different times in that same string. These strings are entered by users so there is definitely a possibility they make a mistake such as above so I need a way to weed out those mistakes (i.e. the blanks). Any ideas for easiest way to find the "blanks" and NOT have them in the array? Hi I have An array of file paths that I want to build into an array which I can then loop and display in a "file viewer", the problem been that I only want to output the folder name once and then the files within this folder. My solution is below but it doesnt work well once your 2+ subdirs in, the problem is if I have the same folder name deeper in the paths the second time it isnt output. Ideally a multidimensional array would work better that I can just lopp and print from $result['folder'] $result['files'] Iv tried this but when it comes to a subdir I hit a wall any help/pointers is very welcome iv lost 2 days on this and feel Like im just going around in circles now. The array I have is, This is stored in a database with to columns filename and size, this is provided by the user as a string so I cant get the info myself sadly. Code: [Select] array (7) { '0' => string (15) test2/test2.txt '1' => string (15) test1/test1.txt '2' => string (33) test/test_test/test10/test101.txt '3' => string (32) test/test_test/test10/test10.txt '4' => string (23) test/test_test/test.txt '5' => string (13) test/test.txt '6' => string (9) test.root } This is the function iv currently got. function getFiles($array, $size) { global $BASEPATH; include($BASEPATH . '/include/fileTypes.php'); $i = 0; $folderIcon = getFileTypeIcon('folder'); $string = '<div class="torDesc_fileTitle">Name<span class="torDesc_fileSizeTitle torDesc_right">Size</span></div>'; $string .='<div class="torDesc_file torDesc_fileAlt1 torDesc_folderName">' . $folderIcon . '</div>'; $lastCount = 0; $lowerLevel = false; $alt = 1; //First we loop the files foreach($array as $key => $value) { ++$i; $level = 0; //Split the path $keys = strpos($value, '/') !== false ? explode('/', $value) : array($value); $count = count($keys); $padding = 5; if($lastCount < $count) $upperLevel = true; else $upperLevel = false; //Now we loop each item in this path foreach($keys as $k => $v) { ++$level; if($upperLevel && $level == $lastCount) $showFolder = true; else $showFolder = false; $folder = false; //First level folder if($level == 1 && $count !== 1) { //Only output the folder if we havent already done so. if($showFolder || !isset($output[md5($v . $level)])) { $repeater = $level; $tabs = '|' . str_repeat('_', ($repeater) * $padding); $alt = ($alt === 1 ? 2 : 1); $output[md5($v . $level)] = true; $string .= '<div class="torDesc_file torDesc_fileAlt' . $alt . '"> ' . $tabs . '<span class="torDesc_folderName"> ' . $folderIcon . ' ' . htmlentities($v) . 'a</span></div>'; } } //Second+ Level folder elseif($level != $count) { //Only output the folder if we havent already done so. if($showFolder || !isset($output[md5($v . $level)])) { $folder = true; $repeater = $level - 1; $tabs = '|' . str_repeat(str_repeat(' ', $padding * 2) . '|', $repeater) . str_repeat('_', $padding); $alt = ($alt === 1 ? 2 : 1); $output[md5($v . $level)] = true; $string .= '<div class="torDesc_file torDesc_fileAlt' . $alt . '"> ' . $tabs . '<span class="torDesc_folderName"> ' . $folderIcon . ' ' . htmlentities($v) . 'b</span></div>'; } } //Its a file else { $alt = ($alt === 1 ? 2 : 1); $ext = explode('.', $v); $ext = strtolower($ext[count($ext) -1]); $img = getFileTypeIcon($ext); $repeater = $level - 1; $tabs = '|' . str_repeat(str_repeat(' ', $padding * 2) . '|', $repeater) . str_repeat('_', $padding); $string .= '<div class="torDesc_file torDesc_fileAlt' . $alt . '"> ' . $tabs . '<span class="torDesc_fileName"> ' . $img . ' ' . htmlentities($v) . 'c</span><span class="torDesc_fileSize">' . mksize($size[($i -1)]) . '</span></div>'; } } $lastCount = $count; } return $string; } Hey, Im trying make a way to check an input to make sure it only consists of "1,2,3,4,5,6,7,8,9,0 and . " I thought i could explode the number and check it to an array that has "1,2,3,4,5,6,7,8,9,0 and . " I havent worked with arrays before so i dont quite know how they work or to go about this? Any ideas cause im sure im not the first to ask for something like this Thanks Ok, this was driving me nuts. I think I found the cause, but need help fixing it. I have a bunch of answers in a MySQL database in the form of... Miami Heat/heat/miami Orlando Magic / orlando/ magic etc. etc. *Notice how sometimes there are leading or ending spaces (i.e there is a space before "magic" but NOT a space before "miami")... I run this code to bring back the answers data (all acceptable answers) in an array. I then look for the user entered answer ($userinput, which has trim and strtolower run on it) in the array. Using this code below, the answer IS found if $userinput is any of the Miami Heat options, but it is NOT found if it's any of the Orlando Magic options. The only difference is the fact that there are spaces in the Orlando Magic stuff. Apparently, the trim() function is only removing space from the beggining and end of the ENTIRE string. But I need to trim() each item in the array. How can I do this? Seems like it should be easy but can't figure it out. Code: [Select] $sql = "SELECT * FROM answers WHERE quizid = $quizid"; $result = mysql_query($sql, $connection); if (!$result) { die("Database query failed: " . mysql_error()); } else { while ($getanswers = mysql_fetch_array($result)) { $array = explode("/", strtolower(trim($getanswers['answer']))); if (in_array($userinput,$array)) { echo "the answerid = " . $getanswers['answerid'] . "<br>"; } else { echo "the answerid is not found= <br>"; } } } Hi there, Need a little help here if anyone has the time. In short, I have a page that is dynamic, that sends POST data to a handler, pretty standard stuff. Normally, for me anyway, I know what the field names will be in advance and handle then as usual. In this case the form content is created dynamically from a GUI I created and the names of the fields are suffixed with the product ID. Within the handler I have stripped the POST data down to the main two vars, namely the pid- product ID and qty- quantity ordered and within a loop created a string to explode() like; 9_33_21_66 $oStrArray = explode('_', $ostring); echo "ostring[0] =".$oStrArray[0]; echo "ostring[1] =".$oStrArray[1]; echo "ostring[2] =".$oStrArray[2]; echo "ostring[3] =".$oStrArray[3]; Result => ostring[0] =9 ostring[1] =33 ostring[2] =21 ostring[3] =66 Now, the 1st, 3rd, 5th etc will be the pid and the 2nd, 4th, 6th etc. will be the qty. Only two sets are used in this example, normally 50+ pairs of values will be present. If it helps with the loop that I need to create - if a foreach will not suffice - I can deduce how may pairs will be present and send this as a var via GET from the form setting a value for i, for instance. I need to be able to, within a loop, * pull the first value as a pid * run a subroutine to pull the data from the DB table to get all the product info to display on a confirmation page [this is not ecom - just emailed orders for existing clients] I can do all the MySQL Query stuff it is just rationalising the data extracted from the array Well I am sure you can see from that what I am trying to do, I will need to do the multiplications etc. I do not know how to handle the data in the array created by the explode() In logic I would say this if x in $ostring is even then $ostring is a product id [mysql query to get details from table] next item in array is corresponding quantity - print details of product in a table, do the multiplication to give line total and add to $message ready for email - NEXT pair of vars I really hope that makes sense and someone can point me in the right direction - thanks in advance for any assistance. Regards A hey guys, I apologize, as this stuff should be easy to figure out, but I am getting stumped again being a php rookie. I have searched a lot for an answer before I bothered you all. Here's the skinny: I have a string coming in via post content that looks like: name1\x1ddata1\x1ename2\x1ddata2\x1e ... where the delimiters are 0x1e for the field/data pairs and 0x1d between the field/data . there may be as many as 20 of these pairs in the string. I have the string and I can store the pairs with explode in an array correctly, I just cant seem to get them all into one array. it would be even more helpful if the first element of the pairs were the array keys. Any guidance would be helpful. Thanks Code: [Select] $raw_post_data=file_get_contents("php://input"); $records=explode("\x1e",$raw_post_data,-1); foreach($records as $data){ $pairs=explode("\x1d",$data);} Hi, I'm not sure if this is a wierd one, I have lots of arrays i'm looping through like this to see them:- for($i=0; $i <count($confirmed); $i++){//loop through print_r_html($confirmed[$i]); } Which shows the following :- Code: [Select] Array ( [0] => AAAAAA-BBBBBB [1] => 2 [2] => 2010-09-29 ) Array ( [0] => AAAAAA-BBBBBB [1] => 2 [2] => 2010-09-28 ) Array ( [0] => CCCCCC-DDDDDD-EEEEEE [1] => 3 [2] => 2010-09-29 ) Key 0 is a Groupconcat split by "-" Key 1 shows how many fields are in 0 Key 2 is just the date What I would like to do is split the first array into 2 arrays, the second in 2, and the third into 3 (therefore ungrouping the groupconcat if you will) as such:- Code: [Select] First into these two:- Array ( [0] => AAAAAA [1] => 2 [2] => 2010-09-29 ) Array ( [0] => BBBBBB [1] => 2 [2] => 2010-09-29 ) Second into these two:- Array ( [0] => AAAAAA [1] => 2 [2] => 2010-09-28 ) Array ( [0] => BBBBBB [1] => 2 [2] => 2010-09-28 ) Third into these two:- Array ( [0] => CCCCCC [1] => 3 [2] => 2010-09-29 ) Array ( [0] => DDDDDD [1] => 3 [2] => 2010-09-29 ) Array ( [0] => EEEEEE [1] => 3 [2] => 2010-09-29 ) ) I know I can get out the info from the first of the keys in each array by putting this into the loop:- for($i=0; $i <count($confirmed); $i++){//loop through if($i==0){ $seperated[] = explode("-",$confirmed[$i]);//split by "-" } } print_r_html($seperated); but i'm not sure how to copy the other keys at the same time? If anyone has got any ideas that would be great! thanks in advance Kev. I need to extract data from a CSV file and insert it into a MySQL database. I am able to extract the data, however I cannot figure out how to group it. Sample File: 01 ISBN Name of Book Price 02 ISBN Name of Book Price So far I have an array with the entire file (reading file with PHP): Array ([0] => 01 [1] => 12345678X [2] => Title [3] => 120.00 ...etc. How can I modify the array to create groups of four for each item? Each item is its own array? I am looking at the code below: Code: [Select] $array = array( array( 1, 2 ), 'a' => array( 'b' => 1, 'c' ) ); Is this an example of a multidimensional array? If so how would I access the value of 1 from key b? Also would the next line ('c') be automatically assigned to the asociative key of c? I've been working on some code to: 1. Search a db for rows that have a particular "position" value 2. Search the same db for rows that have a particular "langs" value 3. Compare the two arrays resulting for 1 and 2 4. Create a multidimensional array $langsarray[langs][question id] if 3 is true. 5. For each langs array in $langsarray pick a random, non-duplicate value and add it to $qarray for a maximum of 12 elements (3 for each langs). What I have works about 95%. The problem is, in the first langs array, one of the 3 randomly picked values is almost always empty, and its not always the same element. Sometimes its the first, sometimes its the third, sometimes its the second... I think I've narrowed down the issue to line 44 ($qtemp = ...). If I change the min/max values for the mt_rand function, it behaves slightly differently. Any help is much appreciated! Thanks in advance. Code: //Include MYSQL class and authentication information require_once('./include/mysql.php'); require_once('./include/global.php'); //Grab apptype from URL querystring $apptype = $_GET['apptype']; //Declare arrays $qarray = array(); $posarray = array(); $langs = array(); $langsarray = array(); //Get id's of all questions pertaining to position type $sql = 'SELECT * FROM qa WHERE position = "' . $apptype . '"'; $result = $db->query($sql) or die(mysql_error()); while ($row = $result->fetch()) { $posarray[] = $row['id']; } //Determine what types of questions should be pulled if ($apptype == 'fed'){ $langs = array('html','css','javascript','jquery'); } else if($apptype == 'bed'){ $langs = array('php','asp','javascript','jquery'); } //Get each question of each language that matches the position type and store it in the multidimensional array $langsarray[language][question id] $z = 0; while ($z < count($langs)){ $sql = 'SELECT * FROM qa WHERE langs = "' . $langs[$z] . '"'; $result = $db->query($sql) or die(mysql_error()); while ($row = $result->fetch()) { if (in_array($row['id'],$posarray)){ $langsarray[$langs[$z]][] = $row['id']; } } //Takes a random question id from the current language ($z) and adds it to the final question array. $y = 0; while ($y < 3) { //$qtemp = $langsarray[$langs[$z]][mt_rand(0,count($langsarray[$langs[$z]]))]; $qtemp = $langsarray[$langs[$z]][mt_rand(0,count($posarray))]; if (!in_array($qtemp,$qarray)){ $qarray[] = $qtemp; echo $qtemp . ', '; $y++; } } echo $langs[$z]; print_r( $langsarray[$langs[$z]]); echo '<br />'; $z++; } echo '<br />'; print_r($qarray); Output: 5, , 2, htmlArray ( => 1 [1] => 2 [2] => 3 [3] => 4 [4] => 5 ) <--Problem 7, 6, 9, cssArray ( => 6 [1] => 7 [2] => 8 [3] => 9 [4] => 10 ) 14, 15, 13, javascriptArray ( => 11 [1] => 12 [2] => 13 [3] => 14 [4] => 15 ) 21, 17, 20, jqueryArray ( => 16 [1] => 17 [2] => 18 [3] => 19 [4] => 20 [5] => 21 ) Array ( => 5 [1] => [2] => 2 [3] => 7 [4] => 6 [5] => 9 [6] => 14 [7] => 15 [8] => 13 [9] => 21 [10] => 17 [11] => 20 ) <-- Final $qarray Hi everybody, I generally find any assistance that I need on various sites, but this one has me stumped. I'm not overly advanced with my use of arrays, so I'd like some help here if anyone knows what I am looking for. I have a form that I would like to submit to a MySQL database. In that form, there is the ability to add up to 3 harddrives: Code: [Select] Brand: <input type="text" name="hdds[0][hddbrand]" id="hddbrand"><br/> Model and/or size,type: <input type="text" name="hdds[0][hddtype]" id="hddtype"><br/> SN: <input type="text" name="hdds[0][hddsn]" id="hddsn"><br/> Notes: <input type="text" name="hdds[0][hddnotes]" id="hddnotes" size="50"> Obviously the next harddrive would be hdds[1][hddbrand], etc. I am having an awful time looping through this to get more than 1 harddrive's information, however. I've tried foreach embedded in foreach and been messing around with this for a good 3-4 hours now and I feel like I am just missing something. I've got this right now to debug: Code: [Select] foreach($_POST['hdds'] as $key => $a) { $hddbrand = $a['hddbrand']; } my print_r($a) comes up with the following: Code: [Select] Array ( [hddbrand] => Toshiba [hddtype] => Shaba 500gb [hddsn] => 5fu8bvw4 [hddnotes] =>none ) 1 Good. That's what I want. But I need some help constructing my array/loop to get the values of more than 1 drive should I have to enter information for more than 1 drive. I feel like I am close, but I am just not getting what I need. I have not had to work with multidimensional arrays before and they are proving to be more trickier than I expected. Any help would be enormously appreciated! Patrick I am working on a csv file import to mysql, which will include items in one table (irrelevant here), and a hierarchical table of categories (id | name | parent). I would think the simplest method to get each category name is too explode the categories from the csv into an array, for example: $array = "root/Business/Employment"; $categories = explode("/", $array); My problem though, is figuring out what the ID's are for each of the categories without knowing each name will be unique and not knowing for sure the full depth of each category hierarchy either. So (I think) I need to rely on the category structure to define the lowest level ID. So something like this: Code: [Select] SELECT t1.parent AS p1, t1.name AS lev1, t1.id AS cat1, t2.name AS lev2, t2.id AS cat2 FROM (categories AS t1) LEFT JOIN categories AS t2 ON t2.parent = t1.id WHERE t1.parent = '1' AND t2.name = "Employment"; This gives me the ID of Employment, but it's easily possible that the name will be duplicated somewhere else in another heirarchy (in fact I get 4 results from phpmyadmin). And since I don't know all these will be only 3 levels deep, it won't work all the time. Any ideas help would be greatly appeciated! Hi All I'm new to php and I have a multidimensional array set up which I need to sort for a results list from an assessment. The array is $gradout['name']['userid']=score. I need to sort the array by score in a decending order. ['name'] is a string and ['userid'] is a numeric. I've tried looking at the php manual but It's just confusing me. Can anyone explain to me in laymans terms what I need to do and why. Hi freaks, Got a simple one for ya, I THINK? I have a multi-array that resembles this.. Code: [Select] $_SESSION["book_array"] = array(0 => array("plantID" => $plantID, "botanicalName" => $botanicalName, "commonName" => $commonName, "use" => $use)); I would like to sort it by the botanicalName key of the inner array before I call the forech loop that renders the display so that after it renders the table the items will be seen alphabetically, code below.. Code: [Select] <?php $bookOutput = ""; //$plant_use_array = ''; if (!isset($_SESSION["book_array"]) || count($_SESSION["book_array"]) < 1) { $bookOutput = '<tr><td colspan="4"><h6>Your Book is EMPTY!</h6></td></tr>'; } else { // Start the For Each loop $i = 0; foreach ($_SESSION["book_array"] as $each_item) { $plantID = $each_item['plantID']; $botanicalName = $each_item['botanicalName']; $botanicalName = stripslashes($botanicalName); $commonName = $each_item['commonName']; $commonName = stripslashes($commonName); $use = $each_item['use']; //$x = $i + 1; // Dynamic table row assembly $bookOutput .= "<tr>"; $bookOutput .= '<td><a href="plant_details.php?plantID=' . $plantID . '" id="bodyLink">' . $botanicalName . '</a></td>'; $bookOutput .= '<td>' . $commonName . '</td>'; $bookOutput .= '<td><strong>' . $use . '</strong></td>'; $bookOutput .= '<td><form action="book.php" method="post"><input name="removeBtn" type="submit" value="Remove"/><input name="index_to_remove" type="hidden" value="' . $i . '" /></form></td>'; $bookOutput .= '</tr>'; $i++; } } ?> Any help would be much appreciated! Thanks in advance. |