Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
  Advanced Search
  HOME    TRACKER    PHP






SuperbHosting.net have generously sponsored dedicated servers to ensure a reliable and scalable dedicated hosting solution for BigResource.com.





Lists Files In Dir On Page, But Needs To Sort


I have the following code that successfully lists files found in a directory. But, by default it sorts the list by file creation date. How do I make it so that it lists the files in alpha order by filename? Code:




View Complete Forum Thread with Replies
Sponsored Links:

Related Messages:
Converting Inc Files Into Linkable Lists
I have a script that reads a directory, strips various parts of the name and creates a list that can be used as links. Unfortunately, the script gives me the following error when I run it:

Parse error: parse error, unexpected '.' in /home/hearnofg/public_html/temp/sermons/index.php on line 16

The follwoing is my code:

View Replies !   View Related
Lists The Files In A Directory Echo Names Without Extension
I have an open directory document which lists the files in a directory. Is there any way to echo the name without the extension.


$dir = $_GET['artist'];
if ($handle = opendir($dir)) {
while ($file = readdir($handle)){
if ($file != '.' && $file != '..' && $file != 'info.txt'){
echo "<a href ="$dir/$file">".$file."</a>";
}
}
closedir($handle);
}

View Replies !   View Related
Updating Lists On Page
The problem is that I am displaying all the rows of my table which have the value of the field 'approval' as 0. Now, there are to be 2 buttons next to each row with names "Approve" and "Disapprove".

If you click on approve, then the value of 'approval' for that row becomes 1 and if you click on "Disapprove" , the value of 'approval' becomes -1. How to accomplish it ? as the list being viewed will be changing very often. Code:

View Replies !   View Related
Get Two Dropdown Lists Working On A Page
i am trying to get two dropdown lists working on a page. How do i go about this. For example, I have 1 table which holds countries and cities. When a user selects a country in the first dropdown list, i'd like the second dropdownlist populate with a list of cities etc. from my database.

View Replies !   View Related
Saving Selection In Drop-down Lists In PHP After Page Reload?
I can't find an answer to my quesiton anywhere.

Given a drop-down list with USA states and other text fields I pass
this information for further processing via PHP. If any of the required

fields is empty, the PHP script would return an error and reload the
form page asking to fill out those fields. All entered information is
saved... except for the drop-down list selection. I tried to write a
Javascript function which is echoed by PHP, but interpolation of PHP
variables in the Javascript section gives a syntax error message in
Javascript.

The PHP script returns, e.g., an "AL" string for Alabama. Of course, I
don't want to write PHP code for each option to make it selected.

View Replies !   View Related
Dynamic Lists And Producing Rows On The Preceding Form Page
I have created the following dynamic drop down: Code:

View Replies !   View Related
Sort Files In A Folder
I've got a bit of a problem. I found a script that reads files from a folder, and I modified it so that it can read image files and give extra info about them. but it only sorts the files by alphabetical order; I want it to sort them by date as well. I've been tinkering with it, but all to no avail. I only got it to sort the files by reverse alphabetical order (rsort()). Here's the whole script:

<?php

$folder = 'http/path/to/folder/';
$imgdir = 'absolute/path/to/folder';
$allowed_types = array('png','jpg','jpeg','gif');
$total_images = count(glob("$imgdir{*.gif,*.jpg,*.png, *.jpeg}", GLOB_BRACE));

?>

View Replies !   View Related
Sort Files Newest To Oldest
Assume the paths to some files are already stored in an array (in no particular order), dynamically created but equivalent to:

$imgArray[] = '/server/images/1a.jpg'
$imgArray[] = '/server/images/2a.jpg'
$imgArray[] = '/server/images/other/1.jpg'
$imgArray[] = '/server/images/other/2.jpg'
$imgArray[] = '/server/images/other/3.jpg'
// etc.

Is there an easy way to create a new array, ordering the files from newest to oldest.

View Replies !   View Related
Lists Files In "http" Path
I just got a quick question. Basically what I want to do is scan a directory and write a bit of info to a database based on the files in that directory. Now that is easy to do, and I know how to do it.

The thing I am having problem is getting it to scan a directory like "http://google.com/files/". That directory is browseable so thats not an issue. Im guessing that there is a different command to browse a directory with an "http" path.

View Replies !   View Related
Form Input Page To Sort With Link
I'm looking to create a page that a user can input data into a form and submit it to a mysql database.  From there I want another page to display the data sorted by a certain field of the data that was entered (i.e. Year) and then be able to click on the field that is sorted by (Year) and go to another page that displays all of the information that was originally entered.

View Replies !   View Related
Forms - Set Some Sort Of Cache Or Something So That I Wont Have To Keep Refreshing The Page?
I have a lot of forms on the site I'm working on and basically I get this error if I click 'back' in my web browser. Is there anyway I can set some sort of cache or something so that I wont have to keep refreshing the page?

View Replies !   View Related
Session - Sort ALL The Columns Then Transfer That Sorted Table To A New Page For Printing.
I'm not fully conversent with sessions and I suspect they are the answer to this problem but I cannot figure this one out yet.

I have a table with data drawn from a database and some calculated on the page.
e.g.

 1 Name | Score 1 |Score 2 | Average Score  where average score is calculated on the page.
 2 Name | Score 1 |Score 2 | Average Score
 3 Name | Score 1 |Score 2 | Average Score
 4 Name | Score 1 |Score 2 | Average Score
etc.

Can I carry this data to a new page without having to call from the database again.
The reason is that I want to sort ALL the columns (which I can do already) but then transfer that sorted table to a new page for printing.

View Replies !   View Related
Re-Directing Back To "Sort After" Page&
I am using sessions and a MySQL user database to restrict users to certain pages on a website. If the user has not logged in and tries to access a protected page they will get the login page.

Now if they are trying to acess a page like specials.php and they have to logon to access that page, then they get the login page and they then enter login details to access it. If their login is correct, I send a header Location to the Index of the site. How do I direct the user to the page they were looking to access(specials.php) without getting directed to the index.php page. I want to implement this function to all the restricted pages. I know its something pretty simple... maybe keep the url of the "sort after" page in a variable and then re-direct to that page after login ? Can someone give me a hint

Thanks

View Replies !   View Related
100's Of Video Files Into 1 Page
I am creating a website that will have 100's of video files. Now i want to play these in an embedded windows media player. Which i know how to do.

What i want to know is how do i have it so once a link is clicked it is played into the same page each time. So I don't have to create 100's of pages, 1 for each video. I can just have the 1 video page that they are all played into.

I have been useing macromedia dreamweaver up to now.

View Replies !   View Related
Replacing Linked Files In A Page?
trying to come up with a system which will strip out all files on a webpage and replace them with the correct url for said file, this is for use in an include system where i can fake the urls. ie. everything on my site goes through the main index.php file so

http://www.mysite.com/index.php
is the same as
http://www.mysite.com/this/is/a/fake/url/

because this/is/a/fake/url/ is passed as a variable to the index.php (using a modrewrite) which finds the real url in a database and then includes() it!

now because
http://www.mysite.com/this/is/a/fake/url/
might correspond to
http://www.mysite.com/project/1/

all linked files on the page will be lost unless absolute urls are used. Now to avoid absolute urls i want to go through the page, replace all filename with the correct url and then echo out the page. now its the parsing of the page that concerns me, so far i've done this.. PHP Code:

View Replies !   View Related
Loading Swf Files Into A Php Page From A Database....
I am wanting to create a games website where all the data is stored in a database.

i want the urls for the swf also in the d.b.

so when the page loads it will show all the games on the site and when clicked it will load the correct swf url depending on the game name.

View Replies !   View Related
Changing Titles Per Page With Inc Files.
The way my script is set up now, I have an index.php which calls on inc files.  The problem is that each page (inc file) is using the title set in the php.index.

My goal is to have a title for each page.  I've looked and looked but can't find anything. 

View Replies !   View Related
Set Up A Page Where An Admin Can Upload Files
I need to set up a page where an admin can upload files (any kind of file) and put in a name for that file, then have that name and the date it was uploaded dynamically put into a directory.

View Replies !   View Related
Display .txt Files On Html Page
I tried to ask this query a while ago but it didnt show up. Apologies if im double posting. I would like to devise a method where a site owner can update their own site easily by uploading a text file (news.txt), which then displays within a set width iframe in the news.html page.

What would be the php code to do this? Its seems like it should be really simple but im a complete beginner at php!

What i'd like even more is to have a password protected page (or any page would do!), where the user can enter their new webpage content into a form, which then writes to the news.txt text file, and displays that new info on the news.html page (again in a scrolling iframe probably).

Am i making any sense? I have no idea if this is possible or not, but would really appreciate any pointers or maybe even code?

View Replies !   View Related
Why Do Files Using The 'include' Function Always Appear At The Top Of The Page?
I am having trouble with an include file. The file that I am including in my web page controls a random flash banner rotator. All that you have to do is add the following to the page and the banner is displayed:

<? php include("http://www.xxxxxxx.com/yyyyyyy"); ?>

The problem I have is that the flash banner always appears at the very top of the page, but it should be appearing where it is told to, which is half way down the page within a table I have set out.

I have tried the following but I get the same result:

<?php $file = file_get_contents("http://www.xxxxxxxx.com/yyyyyyyy"); 

echo $file; ?>

Can anyone help? Are include files automatically set to appear at the top of the page? Am I missing something?

View Replies !   View Related
Creating .xls And .doc Files With Page Breaks Using PHP / MySQL
Our company currently processes a few hundred form submissions through
our site. Up till now, the contents of the form has been sent to our
customer support staff in real-time. Each submission goes to a general
e-mail box where it's printed through our mail client. A copy of the
form is also stored in a MySQL db, although it's not used that often.

I have been asked to figure out a way to stop delivering the form
submissions in real-time and migrate to the following:

Each morning, provide an Excel spreadsheet and word document (or PDF)
with a certain number of form submissions to each customer support
rep. For example, say 200 form submissions were processed the day
before. This morning, I should split those 200 among the 5 support
reps and provide each of them a certain amount (which can change
daily). Assuming each person gets 40 form submissions, each person
would need to be given an excel file and .doc document that contains
their 40 form submissions.

One of the most important things is that the .doc file needs to have
each form submission separated by a page break, so that when they
print the document each form submission is printed on a separate page.

Finally, not all of the fields from the form submission should be
given to the support rep. Maybe date and time is left off.

View Replies !   View Related
Link To Local Files Through A Dynamic Page
I decided to flesh out my php skills by building a web application
which could scan through local files on my intranet (specifically
mapped drives on my server) and generate a list of Movies or pictures
or music, etc. Which worked fine, I created the code to do that and to
store the results in a mysql database. I can even print it out to a
..php page and sort it however I like.

What I can't seem to do is to create links to the data I've indexed in
a way that will let me open them from the generated php page. I've
searched and searched and there just doesn't seem a way to do this.
I'm pretty sure I've exhausted the obvious options.

The following trials did not work when the document was served from an
apache web server.

<?php
echo "<h1><a href=file:///c:/temp.txt> HEY </a></h1>";
echo "<h1><a href=file:///c: emp.txt> HEY </a></h1>";
?>
<a href=file:///c: emp.txt target="_top"> temp.txt </a>
<a href=file:///c:/temp.txt target="_top"> temp.txt </a>

When the same page was loaded directly from the file instead of served
through apache the bottom two links worked. This doesn't really help
me however. I need to be able to dynamicly generate pages that link to
the files.

I've read that browser security is the restricting factor in this but
changing all of my security settings in IE to low didn't seem to affect
it (not sure what the equivalent of security settings is in Firefox).
Does anyone know of a way to link to local files directly in a way that
lets you open them directly from the source instead of by downloading
them to a temp file or saving the file to somewhere locally? Is it
even possible in PHP?

View Replies !   View Related
Making Next Page Display When Uploading Files
I have a page that uploads up to 8 images at once. On the next page I have a processing animated gif that I would like to show while the images are being processed (resized, renamed, uploaded, etc..).

I have tried using flush() and ob_flush(), but only the top of the page will display.

In other words I click ok and the page freezes for a few seconds, then it goes to the next page where the work is being done and the animated gif is and only the header of the page shows, like where you see PHP Builder header on this page..the rest of the page doesn't display untill all the work is done.

I have flush() and ob_flush() all thru my page like 10-15 times..at the very top, at the bottom, in the middle etc.

View Replies !   View Related
Upload And Download Files (pdf Or Doc File) In My Page
i need to upload and download files(pdf or doc file) in my page using php.
once the user enters the login page it shd display his own company information and he can either upload or download files and shd be able to view the archived ones
can somebody suggest me how to do this?

View Replies !   View Related
Mailing Lists
I have searched in many places about how to set up a mailing list that is scalable yet no web sites seems to want to give out this info. I need to have this mailing list be effective even up to hundreds of thousands of users. Any advice/resources on how to set up this mailing list?

View Replies !   View Related
Email Lists
How would I go about making email lists? Someone who has something similar to what I want told me that they handle it with PHP. I'm not talking about a form where I can email an entire list, but rather an email GROUP, such that any time email went to URL from ANYONE that is a member of my site, it would come into domainname.com, and then sent back out to everyone in the "group".

Any info would be helpful. Is this possible with php? What is the email process? Right now I'm not even on a domain name on my own server.

View Replies !   View Related
Ordering Lists
I have developed a script (with help) that tries to order events stored in my .txt file by date. The .txt file looks like this: 1st|Jan|Meeting at House| 15th|Feb|Meeting at your House etc

The script orders the dates from lowest to highest but does not order dates before the 10th. Apparently 1st - 9th comes after 31st.. Code:

View Replies !   View Related
Dropdown Lists
I've been doing a site for a while now that has several drop down lists in a form. On one form there is the same drop down list repeated 3 times from the same table in a database but with different values. What would be the best way to repeat the code without repeating all of the code. Basically looking at an more economical way to do things. Would you do a while statement and loop through them or maybe a single array and call it when you need it. Any opions?

View Replies !   View Related
PHP And Drop-down Lists
I want a simple HTML drop-down list like this:

<select name="select_1">
<option name="option_1" value="option_1" selected="true">
<option name="option_2" value="option_2" selected="false">
</select>

to be able to automatically select a value according to a value in a table in the database. For example, if a MySQL table has a field named "field_1", and one of the rows has a value of "option_1" in that field, I want the list (using PHP of course) to automatically select the option name "option_1". How would I go about doing that?

View Replies !   View Related
Drop Down Lists
I have used Php to generate a drop down but becos the action of the form is it itself ($_SERVER) I need to echo the value upon submission. Becos this is php generated I'm having problems. This is what the current code looks like:

[PHP]
echo "<select name="branch">
<option value="$variable">$variable</option>
</select>";

View Replies !   View Related
Hyperlink From Intranet Web Page To Local Files On My Computer
I'm creating a company intranet, and every employee has certain
program we want them to be able to run from it, meaning we want the
link to the program to be on the intranet page. For example, Adobe
Photoshop resides on all the employees computer under "C:Program
FilesAdobePhotoshop 7.0Photoshop.exe"

However, when I enter that as a hyperlink on the page, it does not run
the program.

Is there a way to get a web page to run a program on the local host?

View Replies !   View Related
Use Files As Includes From My Index Page Where The Constant Is Defined.
Sample of code:

if (defined('constant')) {
   // show content
} else {
   header("HTTP/1.1 404 Not Found");
}

I am trying to do is, use files as includes from my index page where the constant is defined. What I want to happen is if a user trys to goto blah.php directly, instead of /index.php?page=blah they receive a 404 error, and are sent to the 404 file not found page.

View Replies !   View Related
Maintaining Mailing Lists
I've few doubts; I'm asking two problem here.

1st, can we use PHP for maintaining mailing-lists. Say, we've 1000 users, need be e-mailed a subscription newsletter i.e. $message is same, loop through e-mail array in db.

2nd, Web site search. We maintain database after reading files using PHP and manipulate results from db.

Question is, if PHP is a solution for these problems, also, when users' ( 1 ), keywords' ( 2 ) dbs grow big! There is also a limit of a PHP script execution. In 1st case, PHP has to parse, suppose 10k subscribers, and generate 10k e-mail for sendmail program.

Is PHP feasible for such things. What else, is a better and professionally used solution. I don't know CGI? Perl?

View Replies !   View Related
Multiple Selection Lists?
i have a mutliple selection list on a form that goes like this

<select name='name' multiple size=6>";
echo "<option value='one'>one";
echo "<option value='two'>two";
echo "<option value='three'>three"; etc it works fine.

BUT how do u call it. For example say i selected option one and three. How do i call that on the next page so that ONE and THREE are stored.

View Replies !   View Related
Less-expensive Way To Set Up Defaults In Lists Etc?
I'm currently setting up default selections in <select> lists by
passing an array of those defaults as keys ( 'valuefoo' => true ) as
an argument to the function that sets up the list. Then, as I build
each <option>, I call array_key_exists ( thisoptionvalue,
arrayofdefaults ) to check whether to include the
'selected="selected"' string.

So the code looks something like

Routine ( array( 'valuefoo' => true, 'valuebar' => true ) ) ;
.....

function Routine ( $defaultvals )
{
for ( $i= etc. )
echo '<option....' . ( array_key_exists( 'curroptval',
$defaultvals ) ? 'selected="selected"' : '' ) . etc ' ;
}

(I've elided a lot of syntax, but you get the idea)

That seems slow and tedious. Does anyone know a cheaper way?

View Replies !   View Related
Quote's Invoices Lists...
I need someone to bounce some ideas off.

This is what I'm trying to do, I want to be able to create a script that
will spit out a quote based on the information filled in.

The part I'm stuck on is. Entering all the items in.

Ok, say I have a form, it starts off where you put in all the details
(eg, who the quote is for address phone no etc.)

Then there will be a list of items to go onto the quote.

Now this is the part I'm stuck on. I'm thinking maybe something like an
add new item button that opens a new window and then you enter in the
details for each item.
This then adds each item to the quote. Each item that is entered can be
added directly to the database. So what I'm thinking maybe is a popup
window that you fill in the details for each item, you hit submit, and
then it goes back to the origional quote page, but now with the item
added to the list.

Maybe is there java script where you can open a new window and then
refresh the parent window when the child is closed? this would then have
the items listed.

View Replies !   View Related
Dropdown Lists From A Mysql Db
Id like to load a drop down list from a mysql database using php3 and create a link to that record. Does anyone have any ideas?

View Replies !   View Related
Mailing Lists Under Apache
I must develop mailing lists under Apache but I don't know how to do this, so, if someone knows how to do this.

View Replies !   View Related
Drop Down Lists And Variables
I have a dropdown list with values and I am having trouble getting the value chosen into a variable so that I can use it in an if statement.

View Replies !   View Related
Multiple Lists Selection
I am using a simple registration form that i made with the toolbox, but when I come to a multiple list to choose from (populated from the database) it doesn't work correctly. Of course, out of the multiple items selected only the last one gets inserted.

From what I have read, the selection must be turned into an array then looped for this to work. Is this correct? Next how would I code this to work right. If you let me know which code to post, I will post it.

View Replies !   View Related
Multiple Selection Lists &
I have 2 multiple selection lists. I am using javascript so that users can select items from list 1 and move them to list 2. When the user submits the form I need my php to get the values he has/she has in list 2...

I have done printf($_POST['list_2']) and it only shows one value, even when multiple are selected. I read that I need to change it's name to list_2[] but if I add the brackets to the name my javascript quits working.

View Replies !   View Related
Dynamic Dropdown Lists
I am recoding a greeting card website.

I am using dropdowns as filters for items in a DB, so when the user picks "animals" from the "theme" dropdown, the returned cards all feature animals, and when the user picks "birthday" from the "message" option, the returned cards all feature birthday cards.

However, there are some combinations that don't return any results, for example "get well" "floral" cards. Code:

View Replies !   View Related
Classes And Dropdown Lists
The class below works fine. The problem I have is there's a dropdown list in the middle of the loop. The dropdown list gets its data from another table in the database. Which goes through the same class. So I have a loop within a loop.

What I'm trying to do is ....

View Replies !   View Related
Populating Drop Down Lists
Could anyone help me on populating database driven drop down menus. I am trying to populate a second drop down list based on the selection of the first drop down list. I have the first drop down list running. Not sure about getting the second now.

View Replies !   View Related
Making Lists Of Words
Say I save into a field of a mySql database something like "two, three, four, five, six" all within one field, and then save each individual value into a spot in an array. So my array would go somewhat like a[0]=two a[1]=three and so on. I know how to do this in Java, but not in PHP.

Similarly, is it legal so write
$string = five;
$string = $string + ',' + 'six'

View Replies !   View Related
Dynamic Unordered Lists
I have searched about for this one but havent quite found the low down i'm looking for but here goes.

I'm trying to dynamically populate an unordered list from an SQL database which will have upto 5 or 6 sub-selections per top level list item so.. it would do something like this: Code:

View Replies !   View Related
Dpendent Drop Down Lists
I'm making a system for outage reports, I have a field that refers to the outage type.
I want when choosing from the list, for example, POP, all fields hat doesn't refer to POP issues to disappear. I made a demo with a software PHPrunner 4.1 and you can check it out. exapmle: I choose DNS so all feilds refer to POP and other issues should disappear.

View Replies !   View Related
Tables - Lists All Thumbnails In A Row
On my site I have a php search engine. I have changed the code to add thumbnails but my problem is that it lists all thumbnails in a row with 9 of them. What I need is to have 3 rows and 3 columns.

View Replies !   View Related
Generating Combo Lists
Lets say I have an array:
$fruitarr = array("apple", "banana", "orange", "lemon", "lime", "strawberry");

And I need to generate a list of smoothies over a period of 8 weeks. Each week only two of the fruits can be used together at a time. So for example, the choices for week 1 would be: Code:

View Replies !   View Related
Drop Down Lists And Textfields
I've found this is a great place to learn, so hopefully such can happen with the following:
Basically, I'm trying to develop a world market for a text-based game wherein what is available is listed inside a drop-down list, followed by an input box where the user can enter the amount to purchase (up to the quantity amount available) and submit.

Likewise, I've got a drop-down list populated via a MySQL query.  Altogether, the page looks like this:

My question is, how does one associate the input box with the drop-down list, assuming it's possible (which I would assume)?  Currently, it displays correctly, however when one submits via the "Purcase Goods" button, nothing occurs.  I'm not quite sure how to integrate everything coherently; my knowledge is limited in the area of PHP/HTML integration, so any explanation would be kindly appreciated.

I know long streams of code are often unhelpful in pinpointing a problem (or problems), but in the interest of not excluding an element, here's the code of the file in question: ....

View Replies !   View Related
Putting Lists In Order
I have produced a noteboard style calendar where all events of a particular month are called and then number representing the date is shown and then the event after it. I'd like to know if possible the code which will order the numbers from the lowest to highest number.

<?php

function getevents($eventmonth){

 $file = file("data.txt"); 

 foreach($file as $key => $val){ 

  $data[$key] = explode("|", $val); 

  $day = $data[$key][0];
  $month = $data[$key][1];
........................

View Replies !   View Related
Keeping Selection Lists
I would like to create 2 single-select drop-down selection boxes on a page

box1 - select academic year from 2001, 2002 , 2003 etc

box2 - select semester from 1, 2, 3 etc

As a result course details for all courses that satisfy these selection values get displayed below the boxes. The boxes remain availabel on the page. The user should be able to re-set these boxes to different values to generate different results. The boxes remain visible on the page. Is this possible ?

View Replies !   View Related

Copyright © 2005-08 www.BigResource.com, All rights reserved