PHP - Arrays With .txt Files And Tables
I have been working with a telephone directory that I created for a php class and it consists of three files: One file to write, one file to read and the html directory. Well, four if you include the contacts file. We have to take the file this week and create a two column table with an array from the contact file. I cannot for the life of me figure out how to get an array into two separate columns of a table with the php code.
I will post the code here that I do have (the one I attempted to do the table on is scary..because as I said it's not working like I had hoped, but I did try!) Any sort of direction here would be much appreciated. I have looked through my book and online but all I can find online is examples with SQL and we aren't that far into the class yet. My book doesn't offer any sort of help with tables, just the arrays, so I am stumped and this assignment is due tonight! They have tutoring rooms but I had to take the baby to the doctor this morning and didn't make it in time and they are closed now. :-( Thanks in advance for any type of help of advice you can offer! This is my form: Code: [Select] <html xmlns="http://www.w3.org/1999/xhtml"> <head></head> <body> <form action='phoneWrite.php' method='POST'> <!--Username: <input type='text' size='15' maxlength='25'>--> <h1>Telephone Directory</h1> <br> <table align='Left'> <tr> <td>Last Name:</td> <td><input name='LastName' /></td> </tr> <tr> <td>First Name:</td> <td><input name='FirstName' /></td> </tr> <tr> <td>Street Address:</td> <td><input name='StreetAddress' /></td> </tr> <tr> <td>City:</td> <td><input name='City' /></td> </tr> <tr> <td>State:</td> <td><input name='State' /></td> </tr> <tr> <td>Zip:</td> <td><input name='Zip' /></td> </tr> <tr> <td>Area Code:</td> <td><input name='AreaCode' /></td> </tr> <tr> <td>Phone Number:</td> <td><input name='PhoneNumber' /></td> </tr> <tr> <td></td> <td><input type="submit" value="Register" /></td> <td></td> </tr> <tr> <td></td> <td><input type="reset" value="Clear" /></td> <td></td> </tr> </table> </form> </body> </html> This is the php used to write data: <html xmlns="http://www.w3.org/1999/xhtml"> <head> </head> <body> <?php if (empty($_POST['LastName']) || empty($_POST['FirstName']) || empty($_POST['StreetAddress']) || empty($_POST['City']) || empty($_POST['State']) || empty($_POST['Zip']) || empty($_POST['AreaCode']) || empty($_POST['PhoneNumber'])) echo "<p>You must enter your information.</p>\n"; else { $lName = addslashes($_POST['LastName']); $fName = addslashes($_POST['FirstName']); $address = addslashes($_POST['StreetAddress']); $city = addslashes($_POST['City']); $state = addslashes($_POST['State']); $zip = addslashes($_POST['Zip']); $area = addslashes($_POST['AreaCode']); $number = addslashes($_POST['PhoneNumber']); $NewEntry = "$lName, $fName, $address, $city, $state, $zip, $area, $number\n"; $ContactFile = fopen("contacts.txt", "ab"); if (is_writeable("contacts.txt")) { if (fwrite($ContactFile, $NewEntry)) echo "<p> Registration Success!</p>\n"; else echo "<p> Registration Failed, please try again.</p>\n"; } else echo "<p> Cannot add registration to the database.</p>\n"; fclose($ContactFile); } ?> <form action = "phoneRead.php" method='POST'> <h1>Telephone Directory</h1> <p>Last Name: <input type="text" name ="LastName" size = "20" /></p> <p>First Name: <input type="text" name="FirstName" size = "20" /></p> <p>Street Address: <input type="text" name="StreetAddress" size = "20" /></p> <p>City: <input type="text" name="City" size = "20" /></p> <p>State: <input type="text" name="State" size = "20" /></p> <p>Zip: <input type="text" name="Zip" size = "20" /></p> <p>Area Code: <input type="text" name="AreaCode" size = "20" /></p> <p>Phone Number: <input type="text" name="PhoneNumber: size = "20" /></p> <p><input type="submit" value="Register"/></p> <p><input type="reset" value="Clear" /></p> <a href="http://localhost/MillerAssignment4/contacts.txt">Read file</a> </form> </body> </html> And this is what I have so far on the table/read file: <html xmlns="http://www.w3.org/1999/xhtml"> <head> </head> <body> <?php if ((!file_exists("contacts.txt")) || (filesize("contacts.txt") == 0)) echo "<p> There are no entries in your telephone directory.</p>\n"; else { $ContactArray = file("contacts.txt"); echo "<table style = \"background-color:lightgray\" border = \"1\" width = \"100%\">\n"; $count = count($ContactArray); for ($i = 0; $i < $count; ++$i) { $CurrMsg = explode("~", $ContactArray[$i]); echo "<tr>\n"; echo "<td width=\"5%\" style=\"font-weight:bold\">Name: </span> " . htmlentities($ConNum[0]) . "<br />\n"; echo "<span font-weight:bold\">Phone Number: </span><br />\n" htmlentites($ConNum[2]) . "</td>\n"; echo "</tr>\n"; } echo "</table>\n"; } ?> </body> </html The contact.txt file is attached if you want to look at it Similar TutorialsI have a folder of .txt files which have an array like this: 0#|#1#|#2#|#3#|#4#|#5#|#6 NOTE: All of the textfiles are md5 hashes. Every text file has an array like this, (numbers representing the data) and i'm trying to make it so i can access every array an combine it. So in the end i want to know how many text files have the number "6" for the 6th array and so on. I'm pretty new at PHP, so please be detailed. Hi I am having problems trying to view some data and wondered if anyone could help. I have a table called 'parties' which contains fields - partyid, docid and party. There is another table called 'documents' which has fields - docid and doctitle. I have a number of documents and for each document there are a number of parties - ie people linked to that document. What I would like to do is get a view on screen (and also printed out) that has the title of the document followed by a list of the parties associated with that document. For example, if in the documents table there was: |docid |doctitle | |1 |first document | |2 |second document| and in the parties table there was: |partyid |docid |party | |1 |1 |Fred | |2 |1 |Jim | |3 |1 |Jane | |4 |2 |Peter | |5 |2 |Fred | I could get a view that looked like: First document: Fred Jim Jane Second document: Peter Fred I suspect it may involve arrays but I have never used them so any guidance would be very welcome. Thanks Hello everyone I have two dropdown lists. First one you can see the tables of my db and the second one the files inside a folder. The problem is that i can't send my selections from the dropdown list to an other file. My project is to choose a table, then a CSV file and then load the file in db. index.php: Code: [Select] <?php //EMFANISH PINAKWN include("../forma/dbCon.php"); echo "<form action='load_table_test.php' method='POST'>"; $sql="SHOW TABLES FROM misthodosia"; $result=mysql_query($sql); if (!$result) { echo "Υπάρχει πρόβλημα με την βάση\n"; echo 'MySQL Error: ' . mysql_error(); exit; } echo"<select>"; while ($row = mysql_fetch_row($result)) { echo "<option name='{row[0]}' value='{row[0]}'>{$row[0]}</option>"; } echo"</select>"; mysql_free_result($result); //==========================EMFANISH ARXEIWN========================== function populateDropdown(){ $path = glob("C:\\xampp\\htdocs\\dbadmin\\upload_files\\*"); //the double \\ is not a typo you //have to escape it //if the path cannot be found if(!($path)){ echo("Δεν υπάρχει ο φάκελος"); return; }//if //the path is valid else{ foreach($path as $k){ $i = basename($k); echo "<option name='$i'>".$i."</option>"; }//foreach }//else }//populateDropdown echo"<select>"; populateDropdown(); echo"</select> "; echo"<input type='submit' name='submit' value='Φόρτωσε1111111' />"; echo "</form>"; $hello="hello"; ?> load_table_test.php: Code: [Select] <?php include("../forma/dbCon.php"); echo $_POST['hello']; echo $_POST['{row[0]}']; echo $i; //$pinakas=$_POST['pinakas'] //$arxeio=$_POST['arxeio'] //$pinakas=$_POST['row'] //$arxeio=$_POST['diadromi'] //mysql_query("LOAD DATA LOCAL INFILE "$arxeio" INTO TABLE $pinakas //FIELDS //TERMINATED BY ',' //ENCLOSED BY '\"' //LINES TERMINATED BY '\n') echo "$arxeio"; echo "$pinakas"; echo "<br/><br/><br/><br/><br/><a href='index.php'>Επιστροφή στην προηγούμενη σελίδα.</a>"; ?> errors: Code: [Select] Notice: Undefined index: hello in C:\xampp\htdocs\dbadmin\load_table_test.php on line 6 Notice: Undefined index: {row[0]} in C:\xampp\htdocs\dbadmin\load_table_test.php on line 8 Notice: Undefined variable: i in C:\xampp\htdocs\dbadmin\load_table_test.php on line 9 Notice: Undefined variable: arxeio in C:\xampp\htdocs\dbadmin\load_table_test.php on line 27 Notice: Undefined variable: pinakas in C:\xampp\htdocs\dbadmin\load_table_test.php on line 28 I'm having troubling with trying to create a function to spit out a single array with the following array. I can write it in a away that looks through the arrays manually. the results i am trying to generate is that each item in generated array. Array to convert array( "account" => array( "login", "register", "logout", "edit", ), "p" => array( "report", ), "array1.0" => array( "array2.0" => array( "array3.0", "array3.1 ), "array2.1", ), generating the array will look like this
Array ( [0] => account [1] => account/login [2] => account/register [3] => account/logout [4] => account/edit [5] => p [6] => p/report [7] => array1.0 [8] => array1.0/array2.0 [9] => array1.0/array2.0/array3.0 [10] => array1.0/array2.0/array3.1 [11] => array1.0/array2.1 ) The idea is that id generates a single array with combined labels and arrays inside, etc. I just can't figure out how to create a script that will create this array even If I add a new value or array.
I have this thing that i am trying to make but i cant get it to work.. can anyone help? Code: [Select] function sql_read( $dbname,$dbusername,$dbpassword ) { $names = array(); $password = array(); $connect = @mysql_connect("mysql11.000webhost.com",$dbusername,$dbpassword) or die("Could Not Connect"); @mysql_select_db ($dbname) or die("Could not find DataBase"); $query = mysql_query("select * from users"); $numrows = mysql_num_rows($query); if ($numrows > 0){ while($row = mysql_fetch_assoc($query)){ $names[] = $row["uname"]; $password[] = $row["password"]; $id = $row["id"]; } $return = array($names,$password,$id); }else{ $return = array(); } return $return[]; } $names = array(); $names = sql_read("XXXXXX","XXXXXX","XXXXXXX")[0]; The error i get is Code: [Select] Parse error: syntax error, unexpected '[' in /home/a5480952/public_html/sql/index.php on line 28 Line 28 is "$names = sql_read("XXXXXX","XXXXXX","XXXXXXX")[0];" Please help... i REALLLLD need help with this.. ask questions if you want to know more about what i am trying to do... thanks! So far I have managed to create an upload process which uploads a picture, updates the database on file location and then tries to upload the db a 2nd time to update the Thumbnails file location (i tried updating the thumbnails location in one go and for some reason this causes failure) But the main problem is that it doesn't upload some files Here is my upload.php <?php include 'dbconnect.php'; $statusMsg = ''; $Title = $conn -> real_escape_string($_POST['Title']) ; $BodyText = $conn -> real_escape_string($_POST['ThreadBody']) ; // File upload path $targetDir = "upload/"; $fileName = basename($_FILES["file"]["name"]); $targetFilePath = $targetDir . $fileName; $fileType = pathinfo($targetFilePath,PATHINFO_EXTENSION); $Thumbnail = "upload/Thumbnails/'$fileName'"; if(isset($_POST["submit"]) && !empty($_FILES["file"]["name"])){ // Allow certain file formats $allowTypes = array('jpg','png','jpeg','gif','pdf', "webm", "mp4"); if(in_array($fileType, $allowTypes)){ // Upload file to server if(move_uploaded_file($_FILES["file"]["tmp_name"], $targetFilePath)){ // Insert image file name into database $insert = $conn->query("INSERT into Threads (Title, ThreadBody, filename) VALUES ('$Title', '$BodyText', '$fileName')"); if($insert){ $statusMsg = "The file ".$fileName. " has been uploaded successfully."; $targetFilePathArg = escapeshellarg($targetFilePath); $output=null; $retval=null; //exec("convert $targetFilePathArg -resize 300x200 ./upload/Thumbnails/'$fileName'", $output, $retval); exec("convert $targetFilePathArg -resize 200x200 $Thumbnail", $output, $retval); echo "REturned with status $retval and output:\n" ; if ($retval == null) { echo "Retval is null\n" ; echo "Thumbnail equals $Thumbnail\n" ; } }else{ $statusMsg = "File upload failed, please try again."; } }else{ $statusMsg = "Sorry, there was an error uploading your file."; } }else{ $statusMsg = 'Sorry, only JPG, JPEG, PNG, GIF, mp4, webm & PDF files are allowed to upload.'; } }else{ $statusMsg = 'Please select a file to upload.'; } //Update SQL db by setting the thumbnail column to equal $Thumbnail $update = $conn->query("update Threads set thumbnail = '$Thumbnail' where filename = '$fileName'"); if($update){ $statusMsg = "Updated the thumbnail to sql correctly."; echo $statusMsg ; } else { echo "\n Failed to update Thumbnail. Thumbnail equals $Thumbnail" ; } // Display status message echo $statusMsg; ?> And this does work on most files however it is not working on a 9.9mb png file which is named "test.png" I tested on another 3.3 mb gif file and that failed too? For some reason it returns the following Updated the thumbnail to sql correctly.Updated the thumbnail to sql correctly. Whereas on the files it works on it returns REturned with status 0 and output: Retval is null Thumbnail equals upload/Thumbnails/'rainbow-trh-stache.gif' Failed to update Thumbnail. Thumbnail equals upload/Thumbnails/'rainbow-trh-stache.gif'The file rainbow-trh-stache.gif has been uploaded successfully. Any idea on why this is? Hello I have a simple question about file handling... Is it possible to list all files in directories / subdirectories, and then read ALL files in those dirs, and put the content of their file into an array? Like this: array: [SomePath/test.php] = "All In this php file is being read by a new smart function!"; [SomePath/Weird/hello.txt = "Hello world. This is me and im just trying to get some help!";and so on, until no further files exists in that rootdir. All my attempts went totally crazy and none of them works... therefore i need to ask you for help. Do you have any ideas how to do this? If so, how can I be able to do it? Thanks in Advance, pros I have two arrays, both with the same key values. I'd like to combine them. So for instance... Code: [Select] <?php $array1['abcd'] = array( 'value1' => "blah", 'value2' => "blahblah"); $array1['efgh'] = array( 'value1' => "ha", 'value2' => "haha", 'valuex' => "xyz"); $array2['abcd'] = array('value3' => "three", 'value4' => "four"); $array2['efgh'] = array( 'value3' => "hohoho", 'value6' => "six6"); function combine_arrays($array1,$array2) { //*combining* return $single_array; } echo "<pre>"; print_r(combine_arrays($array1,$array2)); echo "</pre>"; /* would produce ['abcd'] = ( 'value1' => "blah", 'value2' => "blahblah", 'value3' => "three", 'value4' => "four" ) ['efgh'] = ( 'value1' => "ha", 'value2' => "haha", 'valuex' => "xyz", 'value3' => "hohoho", 'value6' => "six6" ) */ ?> What's the easiest way to do this? Im doing a search system and Im having some problems.
I need to search in two tables (news and pages), I already had sucess doing my search system for just one table, but for two tables its not easy to do.
I already use a select statment with two tables using UNION because I want to show number of search results, that is number of returned rows of my first sql statment.
But now I need to do a select statment that allows me to acess all fields of my news table and all fields of my pages table.
I need to acess in my news table this fields: id, title, content, link, date, nViews
I need to acess in my pages table this fields: id, title, content, link
Im trying to do this also with UNION, but in this case Im not having any row returning.
Do you see what I have wrong in my code?
<?php //first I get my $search keyword $search = $url[1]; $pdo = connecting(); //then I want to show number of returned rows for keyword searched $readALL = $pdo->prepare("SELECT title,content FROM news WHERE title LIKE ? OR content LIKE ? UNION SELECT title,content FROM pages WHERE title LIKE ? OR content like ?"); $readALL->bindValue(1,"%$search%", PDO::PARAM_STR); $readALL->bindValue(2,"%$search%", PDO::PARAM_STR); $readALL->bindValue(3,"%$search%", PDO::PARAM_STR); $readALL->bindValue(4,"%$search%", PDO::PARAM_STR); $readALL->execute(); //I show number of returned rows echo '<p>Your search keyword returned <strong>'.$readALL->rowCount().'</strong> results!</p>'; //If dont return any rows I show a error message if($readALL->rowCount() <=0){ echo 'Sorry but we didnt found any result for your keyword search.'; } else{ //If return rows I want to show, if it is a page result I want to show title and link that I have in my page table //if it is a news result I want to show title and link that I have in my news table and also date of news echo '<ul class="searchlist">'; $readALL2 = $pdo->prepare("SELECT * FROM news WHERE status = ? AND title LIKE ? OR content LIKE ? LIMIT 0,4 UNION SELECT * FROM pages where title LIKE ? OR content LIKE ? LIMIT 0,4"); $readALL2->bindValue(1, '1'); $readALL2->bindValue(2, "%$search%", PDO::PARAM_STR); $readALL2->bindValue(3, "%$search%", PDO::PARAM_STR); $readALL2->bindValue(4, "%$search%", PDO::PARAM_STR); $readALL2->execute(); while ($result = $readALL2->fetch(PDO::FETCH_ASSOC)){ echo '<li>'; echo '<img src="'.BASE.'/uploads/news/'.$result['thumb'].'"/>'; echo '<a href="'.BASE.'/news/'.$result['id_news'].'">'.$result['title'].'</a>'; //if it is a news result I also want to show date on my list //echo '<span id="date">'.$result['date'].'</span>'; echo '</li>'; } echo ' </ul>'; //but how can I do my select statement to have access to my news table fields and my page table fields?? } ?> This portion is kind of stumping me. Basically, I have a two tables in this DB: users and users_access_level (Separated for DB normalization) users: id / username / password / realname / access_level users_access_level: access_level / access_name What I'm trying to do, is echo the data onto an HTML table that displays users.username in one table data and then uses the users.access_level to find users_access_level.access_name and echo into the following table data, I would prefer not to use multiple queries if possible or nested queries. Example row for users: 1234 / tmac / password / tmac / 99 Example row for users_access_level: 99 / Admin Using the examples above, I would want the output to appear as such: Username: Access Name: Tmac Admin I am not 100% sure where to start with this, but I pick up quickly, I just need a nudge in the right direction. The code I attempted to create just shows my lack of knowledge of joining tables, but I'll post it if you want to see that I did at least make an effort to code this myself. Thanks for reading! I am using WPSQT plugin in my blog site .I code some files in PHP also.how to add that files in plugin files.
I am trying to write some data from multiple SQL tables to a page. In the first table is a list of places. I then have more tables that are named after the different places. For example, say my first place in the list is called Place1. I have a table named Place1 with data that corresponds to place1. The data contained in the table named Place1 is a list of things to do in this place. It has 21 columns and each one is something to do in the morning, afternoon, and at night for each day of the week in the place Place1. What I am trying to do is display a sort of weekly calendar as a table on a webpage that lists all of the places in one column and then lists seven days of the week as 7 more columns. Then in each data cell I would want to list the things to do in the morning, afternoon and at night for the certain day of the week and for the place. The problem is that I am creating a CMS to allow other users with no coding knowledge to update events for other places, so I have to display data that could have been altered. The only solution I know of is to do a while loop that gets all of the place names and while there are still place names, write the place names to the page and set a variable equal to the place name. Inside the while loop I would create another while loop that each time the first while loop is executed uses the variable set in the first while loop to know which table to reference and then make a call to that table pulling out the 21 columns and writing them to the page. Each time the outer while loop executes, it would (hopefully) write the place name, and then set the variable as the current place name so that the inner while loop uses the variable to write the rest of the information about that place. I don't know if that would even work and if it did, I know it cannot be the best way to do this. I am pretty stuck here and don't really have a good solution so if anyone proposes a solution that is radically different to anything I have done, I am open to everything. Thank you! I can't work out the quotes around this... $bookingID['$row['id']'] = $row['id']; echo $bookingID['$row['id'];']; Parse error: parse error, expecting `']'' What would fix this? hi all, how can i make this array dynamic. E.g, i want the numbers to be pulled from a database... Code: [Select] $s=array( "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20" ); thanks in advance, i just cant work it out Hello, I'm trying to extract information about a ticket through osTicket SOAP API, but I can't seem to figure out how! This is the return from the script (var_dump): array(1) { [0]=> object(stdClass)#2 (2) { ["question"]=> object(stdClass)#3 (4) { ["id"]=> int(25) ["created"]=> string(25) "2011-01-05T01:19:43+01:00" ["name"]=> string(4) "test" ["message"]=> string(4) "qasd" } ["answers"]=> array(1) { [0]=> object(stdClass)#4 (4) { ["id"]=> int(25) ["created"]=> string(25) "2011-01-05T01:25:06+01:00" ["name"]=> string(17) "Andreas Haakonsen" ["message"]=> string(3) "ler" } } } } A ticket can have several answers. I just can't seem to figure out how to extract/use this data and present it on my webpage. Too many arrays for me to understand I guess :p Is there anyone who can help me with some small code to help me figure this one out? Thanks! Hello, I have 2 array questions that I'm hoping someone can help me with. 1) First, I'm trying to add elements to a previously existing array. I start with: $data = array('text' => $_POST['text'], 'question_type' => $_POST['question_type'], 'solution' => $_POST['solution'], 'filename' => $filename, 'author_id' => $_POST['author']); Then, under certain circumstances, I'm going to want to add the following to the array $data: 'incorrect_solution1' => $_POST['incorrect_solution1'], 'incorrect_solution2' => $_POST['incorrect_solution2'], 'incorrect_solution3' => $_POST['incorrect_solution3']) I tried the concatenation function, combined with an if statement but then PHP thinks that I have a string. 2) Once I have the array, I want to shuffle the solution and 3 incorrect solution indices. I'm not sure how to shuffle just a portion of an array. Any help with either or both questions would be appreciated. Thank you. Hello, I have an array, $solutions, and a separate indexing array, $solution_order. From the $solution_order array (developed from the $order variable, where each $order variable looks like '0321' or '3021'), I'd like to create a new array $ordered_solutions, which indexes on the values picked from the $solution_order array. For example, if my $solutions array is (Big, Small, Fat, Skinny) and my $solution_order array is (2,3,1,0), then the final results should be (Fat, Skinny, Small, Big). I've written down what I have so far. Any thoughts about how to move this forward would be appreciated. Thanks! function GetOrder($solution, $wrong1, $wrong2, $wrong3, $order) { $solutions = array( $solution, $wrong1, $wrong2, $wrong3); $solution_order = array(substr($order,0,1), substr($order,1,1), substr($order,2,1), substr($order,3,1)); $ordered_solutions = array(); //what do to here?? return $ordered_solutions; } Hello! i want to store data in a array (as seen in the code). Im trying to make it so that a php code search through the arrays and find the correct one. once it does it tells me. I dont know if im close, How ever this is what i have. $carrier = $_POST['carrier']; $carriers = array( array("verizon","tmobile","sprint","att","virgin","textnow","metro","unknown"), array("@vtext.com","@tomomail.net","@messaging.sprintpcs.com","@txt.att.net","@vmobl.com","@textnow.me","@mymetropcs.com","@teleflip.com") ); If ($carrier = I've spent many hours trying to solve this with no success. So, here's my challenge. Sample Data from DB: Month Year Measure 5 2010 164 6 2010 31 7 2010 20 8 2010 10 9 2010 10 10 2010 10 12 2010 10 1 2011 10 I need to display this data in a chart, but notice that I don't have data for month 11 and the chart must show all months with data and the month that I don't have data for (11 in this case) will show an interrupted line. I need to put this into an array to display month/year as label and measure as chart value. So, the above data needs to become: Month Year Measure 5 2010 164 6 2010 31 7 2010 20 8 2010 10 9 2010 10 10 2010 10 11 2010 -- 12 2010 10 1 2011 10 The issue here isn't the chart, but how to add the missing month (11) to the array and keep the measures corresponding with their months. Thank you. Let's say I have an array like this: Man1(0), Man1(1), Man1(2), etc. Man2(0), Man2(1), Man2(2), etc. Man3(0), Man3(1), Man3(2), etc. ... and I want to loop through the array. I know I can do: Code: [Select] $i=0; while $i<=99 {//...do something with Man1[$i];} i++; but can I also do a loop with each Man? Like: Code: [Select] $i=0;$a=1; while $i<=99 {//...do something with Man$a[$i];} i++;a++; I've written all the code for each Man separately and I'm thinking there's got to be a way to shorten the code with another loop, but I don't know how. Hope that makes sense. Thanks. |