How To Create Html List From Such Array ?
I've got an example array like this:
$myArr = array(
array("jj", "0", "jjj"),
array("ee", "0", "eee"),
array("bb", "ee", "bbb"),
array("ll", "ee", "lll"),
array("ff", "0", "fff"),
)
Where each row is an array with columns: id of list element, id of parent
list element ("0" means main node) and content of the element. So, from my
array I'd like to create a list like this:
<ul>
<li>jjj</li>
<li>eee
<ul>
<li>bbb</li>
<li>eee</li>
</ul>
</li>
<li>fff</li>
<ul>
View Complete Forum Thread with Replies
Related Forum Messages:
Create An Array From A List Of IDs Within A Database Table
I need to create an array from a list of IDs within a database table. The table consists of 3 fileds, a unique ID, a user ID and the last is an int value (item number) eg 1 3 7 2 4 5 3 3 2 etc... How would I go about using this query $query1=mysql_query("SELECT itemnumber FROM table WHERE userid = '{$user}'"); Would i be right in thinking I can use: $array = mysql_fetch_array($query1); to store all the item numbers associated with the user specified in the first query?
View Replies !
Create List Of Subdirectores
I need to have a portion of a script read the contents of a directory and extract only the names of subdirectories. Once extracted, I need those names put into an array I can iterate through later to populate a drop-down menu. The reason for this is that the current hosting plan does not have any MySQL databases (not my doing) and the amount of subdirectories changes once another script either creates or destroys a directory.
View Replies !
Create A List From A Recordset
I need to produce a list of All the different "Makes" in a Temporary Recordset. Each "Make" will apear a number of times in the Recordset but I only want each make to appear in the list once. how I can achieve this please. I have pasted (basic) code below. I would very much prefer it to be achieved in the In Body Code only if possible. Code:
View Replies !
How To Create Signup List
I'd like to create a sign up list so users can recieve our newsletter via e-mail instead of snail mail. Is there a fairly easy way to do this? Would Access be sufficient for an email database?
View Replies !
Create List Of Matches!
i list how many times a word appears in some text and create an array of them. so if the text contains 3 <a href='whatever'>whatever</a> i can create a list od the 3 results at the top; 1<a href='whatever'>whatever</a> 2<a href='whatever'>whatever</a> 3<a href='whatever'>whatever</a> search text goes here. search text goes here. search text goes here. search text goes here. search text goes here. search text goes here. search text goes here. search text goes here. search text goes here. search text goes here. search text goes here. search text goes here.
View Replies !
Create A Mailing List For My Website
I want to create a mailing list for my website but i have never done this before, I searched on google and all i found was free mailing lists but when a user subscribes, it takes them to the website that provides the free mailing list and it has an ad for them when i send out an email, can anyone help me create my own mailing list?
View Replies !
Trying To Create Dropdown Menu From List
I am trying to create a dynamic dropdown select menu from a directory containing other directories and files. This is to select a certain page from the list so I can edit it. I only want the files in the menu. Here's what I have so far but it doesn't populate the dropdown. Code:
View Replies !
Create PHP Pages From List Of Files In Directory
this is probably easy for a php pro... but I cant figure it out.. I have a directory of mp3 files named like this. Chevy_Car_Commercial.mp3 There are about 150 files. I am trying to find a script that will make php pages based on the file names. chevy_car_commercial.php And also dump that variable title Chevy Car Commercial into the <title> of the web page... I have made dynamic pages before... but that was using a form..
View Replies !
Create A No-scroll List With Page Numbers ?
I have a site that lets users select a list of music based on genre etc. so each list could be made up of different tracks every time (www.makin-trax.co.uk), especially as I'm adding new tracks each month. I'd really like a way to stop all lists from scrolling, if they are longer than the visible page. I know everyone has a different amount of viewable space on their monitors, so I need a way of restricting the list to a max of about 15 tracks per page, and a way for the user to select which page from that list they'd like to view (eg prev next first last particular page number etc.) This is a fairly new music site, so at the moment the only list that goes past the bottom of the page is the dance genre but, as I mentioned earlier, I'm adding new tracks so all genres will become too long for a single page at some point.
View Replies !
Create A Computer Lab Sign Up That Will List All The Dates
I am trying to create a computer lab sign up that will list all the dates and periods available and will give them the option of selecting their userid from a drop down menu in order to reserve the lab for that period. We have alot of tech unsavy people so it has to be very simple. All I want in the drop down is the word 'Available' and their User ID (which will reserve the lab). <?php if (!function_exists("GetSQLValueString")) { function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") { Â $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue; Â $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue); Â switch ($theType) { Â Â case "text":.........
View Replies !
Trying To Compare Array Values To A Value, Then Create Boolean Array
I have an array that returns data like this (see array below) The array[0] contains all the votes for one story as well as information that pertains to that vote, and the array[1] contains vote information for another story. What I need to do is check is a user_id stored in a session, is in the array, and then create a boolean array from that. For example, here I want to check if the user_id is featured in the first set of data, let's say my user_id is 74. Ok, so it is in the first set of data, so we set the boolean variable to true. Next I need to search the second data field for my user_id, 73. It is not featured here so the value in my array is set to 0. I need an array that returns values either 1, for true, your user_id was found in the table, or false, for your user_id was not featured in the table. They need to be in order of the story too. I'm having trouble one comparing the two variables against eachother, since the array is very deep, and two, creating the array on the fly. Code:
View Replies !
Create Array From Members Of An Array Of Objects
I have the following situation: $list[] is an array of MyElement objects. MyElement has two members: MyElement->member1; MyElement->member2; What I want is to get the following: $newlist[] so that: $newlist[0]=$list[0]->member2; $newlist[1]=$list[1]->member2; $newlist[2]=$list[2]->member2; .... I need to do this using A SINGLE LINE OF CODE. Is it possible? How to do this? I tried with: array_walk($list,create_function('$a,$b,$result',' $result[] = $a->member2;'), &$result); but I get the following error: Warning: Call-time pass-by-reference has been deprecated - argument passed by value; If you would like to pass it by reference, modify the declaration of array_walk(). If you would like to enable call-time pass-by-reference, you can set allow_call_time_pass_reference to true in your INI file. However, future versions may not support this any longer.
View Replies !
Html Pre-selected List Box Scrolled
Is it possible to have a list box with a pre-selected value automatically scrolled to that value when the form is loaded? i.e. if the size of the list box is 3, and the 4th value is pre-selected, I want the list box to appear starting at the 4th value in the form.
View Replies !
Generate A Random List Within My HTML
I'm trying to generate a random list within my HTML. I've done random lists before, but this is giving me problems. In the code below, $file should be printing the array I have stored in $file. $file contains raw HTML, comprised of about 10 items right now, but will be higher as I add to it. (That is why I did the $arraycount). I did a var_dump($file) and I can see that $file does indeed contain what I want it to, but I just cannot get the contents into my page. Code:
View Replies !
HTML 'list/menu' And PHP/mysql
tell me the correct syntax to use for assigning the selected option from a pick-list before inserting to a mysql database? I am trying to give the visitor the option of some 20-30 categories from a pick-list and then I want to store the selected category in a field (called 'cat') in my mysql table.
View Replies !
How To List/find Html Tags In Text
What I try to do is to search a text for html tags. Why. Because I want to use nl2br on the text, but since this command add br instead of all /n it is not a nice thing to add t.x. a html list inside the text. Of course it is possible to add the list and remove all space between li tags, but this is not so readable to the writer. What I try to do is also to add nl only in the plain text and inside li and td tags. So in the li case I have to find <ul> and </ul> and <table>..
View Replies !
List Of Sybmols Like To Display > On Html Page > And Which Are Others
i am making an application. the user can give description and that description is stored in database and then the description is shown on html page. suppose the user has written "<b>hello</b>" in description then in the database the following will be stored "<b>hello</b>" but when i display it on database the hello in bold letter will be displayed. i know the soultion that i have to replace the occurrences of < with < and occurrences of > with > but i don't know that which are other symbols which needs some repair like above so please give me a list of html symbols and their equivalent symbol.
View Replies !
Create HTML Page
I would like to make a form that once you insert data into the form,it ll automatically create a html format of the data you entered in a html and save it in a folder! How do i go by doing this?
View Replies !
Create A New Html File
how to open and edit or add a file but ,I don't know how to create a new ".html" or ".txt" file? I have STFW and STFM but still maybe i'm blind.
View Replies !
Create Html Table
tryin to get a table to add a new td /td for every result from the Db. but can't for life of me figure it out... the nubers are the results and there are 3 required infos from each entry,(abc) so if there were 4 results it would have a 4a,4b,4c... its prob really simple but i cant get it! how would i print it via PHP? Code:
View Replies !
Create HTML Emails
I've been trying to create HTML emails but when i receive the email created by this script the link comes out as text do anyone have any idea why this might be? and what apoach would be best to solve it. Code:
View Replies !
Send An Html Page To People On A Mailing List.
I am wanting to be able to send an html page to people on a mailing list. I have set it up so it sends $mailing_template which sends an html page. Only, when it reaches the inbox it shows as straight html (un parsed) and not as the page. How can I set it to send it as HTML and not straight HTML code please?
View Replies !
How I Can Make A List That Acts Like A Html Jump Menu?
how I can make a list that acts like a html jump menu (for a regular list I have to use a "Go" button in order to achieve the desired behaviour and jump menus I cannot use because they work only with links to other pages). For example,I want such a list filled with questions from my db and when I select one I want to see its possible answers; the page stays the same, only its data differs based on the selection. Or you can have a look at such a jump menu on this website, the one with options for geting to various sections of the forum.
View Replies !
List The Value From The Array
I have a textfield like: <input type="text" name="cant[]"> on the next page i have 10 textfields like this .. so i have an $cant array. how can I list the value of them from the array ? with foreach I suppose but how ?
View Replies !
Take The List From Array
Array 1= If I get an array of FRIEND_ID numbers Array 2= and an array of BULLETIN_ID numbers and somehow in this array the USER_ID of the user who created it Can I take the list from array 1 and find all matches from array2 where the FRIEND-ID in array 1 matches the userid in array 2 and have the result make a new array?
View Replies !
Array And List
trying to split up a comma seperated string into an array and then list, however having some problems, after some assistance if at all possible. I currently have a value, in $r which is 4 values seperated by commas. Im trying to put them into an error and then I try to put them in a list. I code im using. $r = '1,2,3,4' //this is my variable $urlstring = array($r); //put variable into array list($one, $two, $three, $four) = $urlstring; // problem here is that all of the values fro $r get put into the first variable in the list, $one.
View Replies !
Create Html Table With Php Result?
I'm looking to display 5 records in one rows, from the database. What i mean is, basically, let's take the "emails" as an example. I have a table with 100s of email addresses. Now i want to display these email addresses on a html table, but i want to display only 5 email adresses per table row, then the next 5 in the next table row and so on.
View Replies !
PHP Create HTML Email Inserts '!'s
I'm trying to create an email and when it sends the email, it mostly works except that there are '!' inserted at some spots. Checking the html source of the email, looks like they are placed at the end of long lines. I'm assuming there is some issue with the encoding, but searching through groups, nothing I've tried has worked. Can someone let me know if I should be doing something differently with my headers for an html email? I'll change emails to null@null.com. Thanks! $headers = "X-Mailer: PHP " . phpversion() . " "; $headers .= "From: null@null.com "; $headers .= "Reply-To: null@null.com "; $headers .= "Content-Type: text/html; "; $headers .= "charset="iso-8859-1" "; $headers .= "Content-Transfer-Encoding: 7bit ";
View Replies !
Script To Create Html File
I'm looking for a php script that will look in my images folder and for each image in there, create an html file named <imagename>.html and store it in a folder called "pages". I currently use the code inserted below that scans my image folder, creates an xml file that contains a list of the images and the my Flash image gallery reads the xml file to create the gallery. but I would rather do it by the method I'm requesting above and get away from flash. Any ideas? Even if there's a way to modify the code below to do what I want, that would be great. Code:
View Replies !
Create Form Linked To Html
I need to access an SQL database from a webpage so users can update information directly to the database (in the form of a "form"). There are a few fields from different tables in SQL that I need on the form. I have no idea how to even begin. Someone mentioned that PHP is the way to go and I've started looking through tutorials, but thought I would post the question to see if this is even the right language to use.
View Replies !
Combining BBcode To Create One Html Tag
I'm working on some BBCode and I was wondering if it is possible to combine two bbcode tags to create one span tag after the preg_replace e.g. Code: [font=Arial ][b ][color=red ]Text[/color ][ /b][/font ] HTML Code: <span style='font-family:Arial;font-weight:bold;color:red;'>Text</span> instead of HTML Code: <span style='font-family:Arial;'><span style='font-weight:bold;'><span style='color:red;'>Text</span></span></span> Of course I'd need it for multiple instances of nested BBcode tags within the same message.
View Replies !
Create A New .html File On My Server...
i have some data in a variable ($message) that is being emailed with the php's mail() function (an html email actually)...i'd like to also take that html data in the $message variable and have my script also make a new .html (with any random name) file on my server with that $message data, any easy way to do that?
View Replies !
String List To Array
I'm trying to convert a slash-delimited string to an array, but I'm wary of null elements that I want to eliminate. I'm frustrated with explode(), array_unique(), and array_pop(), and I'm wondering if there's a better way. I'm only interested in unique array elements. Here's what I've got $a = "10/20/30" should become an array where $b[0] = 10, $b[1] = 20, and $b[2] = 30. Now here's the fun part. Often my arrays will have $a = "10//" I'd like that to become $b[0] = 10 and that's all. So I tried applying array_unique() to explode("/", $a) but you have to be careful about how many elements are returned. Then I tried to use array_pop() to drop the last element if it's empty, but array_pop returns a scalar string when there's only one element left. So when you use $b = array_pop($q), sometimes there is no $b[0].
View Replies !
Setting A List Into An Array
I need some help creating a calendar display of sorts. I have a list of days as headings and under each day a list of events. Each event can have multiple bands performing. I have two tables: tbl_events & tbl_bands tbl_events contains the date, and show info and a field called band_ID which is a comma delimited list of each bands unique band_ID from table tbl_bands. Here's my problem. I want to take that list output: tbl_events.band_ID = 1,2,4,5,6 and set it into an array. If I set $band = array($rst["band_ID"]); and echo $band[0]; I get 1,2,3,4,5,6 what i need is: $band[0] = 1 $band[1] = 2 $band[2] = 3, etc....
View Replies !
Drop Down List From An Array
I want the array to contain a valid year of birth for anyone between the ages of 16 and 80. I'm pretty sure this code is correct.(though it might be a bit sloppy to all you pros) Code:
View Replies !
Array: Re-generate The Key List?
I have a script that read information from a directory (using scandir()), and puts it in an array. Now I want to filter out all files and unvalid directories (ie: '.' and '..'), so that I keep the normal/visible directories. Than I loop through the array with a while(isset($array[$i])). When I use array_filter() to filter out the unwanted files/directories from the array, it will also delete the keys. So the keys arent for instance: 0, 1, 2, 3, 4, 5 but: 2, 3, 5 When I loop through the array it will say: key 0 (in the beginning, when $i = 0) is not set and so it will stop. How can I re-generate the keys so there wont be gaps between the numbers?
View Replies !
How Can Strip The Text Bullet And Then Make That Copy An Unordered List In The HTML?
I have some text coming into a web page from a MySql DB that contains bullets in the copy. The copy cannot be changed as it is also used in a Quark Xpress document we have connected to the DB. So, my question is how can strip the text bullet and then make that copy an Unordered list in the HTML? This is what I have but and does the indents like a list but no bullets (I guess they are being stripped by the str_replace as well? echo str_replace(Chr(13), "<p>", ("<ul>".str_replace('•', '', $bulletcontent1)."</ul>"));
View Replies !
Dynamic Drop-down List In Array
Q. How do I create a dynamically-generated drop-down list for use in an array. I'm using PHP with a MySQL database (through phpMyAdmin) My database table is called com_courses, and I want to pull the distinct 'title' fields and have them appear as a drop down menu for the user to select in a form. Here is my array, with (at the moment) manually-entered 'titles' (which I now need to be dynamically generated from my database field: 'com_courses.title' array ( "coursetitle", "Course Title:", $EXTRA_SELECTLIST, array ("Report Writing", "Recruitment & Selection", "Presentation Skills", "Essential Telephone Skills", "Time Managememt", "Customer Care", "Other"), 0 ), I am not an experienced programmer, but can play around with php to customize programs. I've read up on arrays (I bought a "Programming with PHP and MySQL" book, but it just stops short of this problem). I can't figure this one out.
View Replies !
Array List Menu Problems
I am trying to store values from a List Menu into an sql database table as an ARRAY. However, when I select the multiple values from the form, it only stores the selected values as 'Array' in the SQL table. Here is the Select Statement: <select name="NOTES[]" size="9" multiple="multiple" id="NOTES"> <?php do { ?> <option value="<?php echo $row_literarydevices['LDEVICE']?>"<?php if (!(strcmp($row_literarydevices['LDEVICE'], $row_Recordset1['NOTES']))) {echo "selected="selected"";} ?>><?php echo $row_literarydevices['LDEVICE']?></option> <?php } while ($row_literarydevices = mysql_fetch_assoc($literarydevices)); $rows = mysql_num_rows($literarydevices); if($rows > 0) { mysql_data_seek($literarydevices, 0); $row_literarydevices = mysql_fetch_assoc($literarydevices); } ?> </select> Can anyone offer a reason to why the values are not being stored?
View Replies !
Indented Text List To Array
I'm trying to get a tabbed list into a structured array and can't seem to get it. I'd like the get from this: PHP Code: <?php $contents = array( Â Â Â Â 'Level 1 Item 1', Â Â Â Â 'Level 1 Item 2', Â Â Â Â " ".'Level 1 Item 2 > Level 2 Item 1', Â Â Â Â " ".'Level 1 Item 2 > Level 2 Item 2', Â Â Â Â 'Level 1 Item 3', Â Â Â Â 'Level 1 Item 4', Â Â Â Â " ".'Level 1 Item 4 > Level 2 Item 1', Â Â Â Â " ".'Level 1 Item 4 > Level 2 Item 1 > Level 3 Item 1', Â Â Â Â " ".'Level 1 Item 4 > Level 2 Item 1 > Level 3 Item 2', Â Â Â Â " ".'Level 1 Item 4 > Level 2 Item 1 > Level 3 Item 1 > Level 4 Item 1', Â Â Â Â " ".'Level 1 Item 4 > Level 2 Item 1 > Level 3 Item 1 > Level 4 Item 2', Â Â Â Â 'Level 1 Item 5',.
View Replies !
Create A Data Entry HTML Form For Given Table
I am working on a simple web site updating utility for a web site. Rather than hard code the data entry forms, I would like to automactically generate them based upon the table a user selects to update or insert into. What is the best way to approach this? for "insert" should I use the MySQL DESCRIBE table command and build a form element for each field according to its data type? for "update" should I use the DESCRIBE command to build the form as above and SELECT statement to populate each element with data, or should I just use a SELECT statement to retrieve the data and use php to determine the field type and choose an appropriate form element?
View Replies !
|