terrymold 7 Light Poster

Hi almostbob
Of course I could always say "Why didn't I think of that?". But thankfully you've got there first.
And your answer looks promising as well. I'll check it out later today and come back here with the result.
Thanks
Terry

terrymold 7 Light Poster

Hi
I am having a bit of a problem with some JavaScript and PHP. The script (below) works exactly as wanted, but if I run it with the latest version of IE, the JavaScript appears to be looping and it makes the link flash, and it can only be stopped by closing the IE browser. I Firefox, it's probably doing the same, but without any flashing.
What I would like is a means of detecting that the JavaScript has already been run, and therefore shouldn't be run again.

<head>
    <script>
        if(navigator.geolocation) {
            navigator.geolocation.getCurrentPosition(function(position) {
                var lat = position.coords.latitude
                var lon = position.coords.longitude
                document.location = "prayer-times.php?latitude=" + lat + "&longitude=" + lon
            });
        }
    </script>

<?php
    error_reporting(0);

    $lat = $_GET['latitude'];
    $lon = $_GET['longitude'];

        echo "Latitude: " . $lat . "<br/>";
        echo "Longitude: " . $lon . "<br/>";
?>

I'm really hoping that there is a DaniWeb expert out somewhere who can offer a solution?
Thanks
Terry

terrymold 7 Light Poster

Hi again rtrethewey

I have changed the variable names as suggested, but it still doesn't work. And just to allay any worries about extra code, here is the entire file, called salat.php. There is definitely no other code involved. Like you, I wish there was a bit of "forgotten" code somewhere, because that might have been where the problem is? But there isn't!

And as you can see, the script doesn't actually do anything yet, mainly because I need the 2 variables (myLatitude and myLongitude) outside of the function showLocation() so I can use the values elsewhere.

<!DOCTYPE HTML>
<html lang="en">
<head>
    <?php
        // SUMMERTIME ------------------------------------------------------------------------------
        $summerTime = "";
        $ThisYear = (date("Y")); 
        $MarStartDate = ($ThisYear."-03-25"); 
        $OctStartDate = ($ThisYear."-10-25"); 
        $MarEndDate = ($ThisYear."-03-31"); 
        $OctEndDate = ($ThisYear."-10-31"); 

        //work out the Unix timestamp for 1:00am GMT on the last Sunday of March, when BST starts 
        while ($MarStartDate <= $MarEndDate) { 
            $day = date("l", strtotime($MarStartDate)); 
            if ($day == "Sunday") {
                $BSTStartDate = ($MarStartDate); 
            } 
            $MarStartDate++; 
        } 

        $BSTStartDate = (date("U", strtotime($BSTStartDate))+(60*60)); 

        //work out the Unix timestamp for 1:00am GMT on the last Sunday of October, when BST ends 
        while ($OctStartDate <= $OctEndDate) { 
            $day = date("l", strtotime($OctStartDate)); 
            if ($day == "Sunday") { 
                $BSTEndDate = ($OctStartDate); 
            } 
            $OctStartDate++; 
        } 

        $BSTEndDate = (date("U", strtotime($BSTEndDate))+(60*60)); 

        $now = time(); 

        if (($now >= $BSTStartDate) && ($now <= $BSTEndDate)){ 
            $summerTime = 1;
        }else{
            $summerTime = 0;
        }

        // FORMDATE --------------------------------------------------------------------------------
        $formDate = date("l j<\s\up>S</\s\up> F Y");
    ?>

    <script type="text/javascript">
        var myLatitude = "";
        var myLongitude = "";
        period = "oneday";
        formDate …
terrymold 7 Light Poster

Hi rtrethewey
The code I showed was the complete JavaScript, except for the opening/closing tags. The variables "latitude" and "longitude" arn't used anywhere else, although that is what I eventually need to do. Where do you suggest I change the variable names? In the function? Or else where?
Terry

terrymold 7 Light Poster

Hi everyone
I have a bit of JavaScript code that I need a bit of help with. It concerns Local and Global scoped variables. In the code sample below, and in the function showLocation, are the two problem variables. If I un-comment the two document.writes, then obviously I can see the two values. But if I leave them commented and go to the bottom of this snippet, then the same two variables are blank.
I have read somewhere online that if you declare a variable outside a function, it is a Global variable and can be used within a function, presumably similar to my code below. But it doesn't work?
What I am trying to do is use GeoLocation to get my Latitude and Logitude (which this snippet does, but only within the Function) and then make use of these two variables later on within the same PHP/JavaScript page.
So my question is this.. How can I make use of a variable, created within a Function, outside of that Function?
Thanks
Terry

        var latitude = "";
        var longitude = "";
        period = "oneday";
        formDate = "<?php echo $formDate;?>";
        offset = "<?php echo $summerTime;?>";

        function showLocation(position) {
            latitude = position.coords.latitude;
            longitude = position.coords.longitude;

//document.write("Latitude 1: " + latitude + "<br/>"); // Variable correct if un-commented
//document.write("Longitude 1: " + longitude + "<br/>"); // Variable correct if un-commented

        }

        function getLocation(){
            if(navigator.geolocation){
                var options = {timeout:60000};
                navigator.geolocation.getCurrentPosition(showLocation,errorHandler,options);
            }else{
                alert("Sorry, browser does not support geolocation!"); …
terrymold 7 Light Poster

Sorry, but I forgot to include the modified script.

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Tarbiyyat Audio Book Player</title>

    <link rel="stylesheet" type="text/css" href="allscripts/ableplayer-playlist.css"/>
    <link rel="stylesheet" type="text/css" href="allscripts/ableplayer.css"/>
    <link rel="stylesheet" type="text/css" href="allscripts/jquery-ui.css"/>
    <link rel="stylesheet" type="text/css" href="allscripts/styles.css"/>

</head>

<body>
    <div class = "head_container">
        Ahmadiyya Muslim Association<br/>
        Tarbiyyat Department, United Kingdom<br/>
    </div>

    <hr>

    <div class = "main_container">

        <h2>Audio Book Player 01 - AikGhaltiKaIzala</h2>

        <audio id="audio1" class="ump-media" preload="auto">
        </audio>

        <ul class="ump-playlist" data-player="audio1" data-embedded>
            <li data-mp3="../AikGhaltiKaIzala/AikGhaltiIzala-001.mp3">AikGhaltiIzala-001</li>
            <li data-mp3="../AikGhaltiKaIzala/AikGhaltiIzala-002.mp3">AikGhaltiIzala-002</li>
            <li data-mp3="../AikGhaltiKaIzala/AikGhaltiIzala-003.mp3">AikGhaltiIzala-003</li>
            <li data-mp3="../AikGhaltiKaIzala/AikGhaltiIzala-004.mp3">AikGhaltiIzala-004</li>
            <li data-mp3="../AikGhaltiKaIzala/AikGhaltiIzala-005.mp3">AikGhaltiIzala-005</li>
            <li data-mp3="../AikGhaltiKaIzala/AikGhaltiIzala-006.mp3">AikGhaltiIzala-006</li>
            <li data-mp3="../AikGhaltiKaIzala/AikGhaltiIzala-007.mp3">AikGhaltiIzala-007</li>
            <li data-mp3="../AikGhaltiKaIzala/AikGhaltiIzala-008.mp3">AikGhaltiIzala-008</li>
            <li data-mp3="../AikGhaltiKaIzala/AikGhaltiIzala-009.mp3">AikGhaltiIzala-009</li>
            <li data-mp3="../AikGhaltiKaIzala/AikGhaltiIzala-010.mp3">AikGhaltiIzala-010</li>
            <li data-mp3="../AikGhaltiKaIzala/AikGhaltiIzala-011.mp3">AikGhaltiIzala-011</li>
            <li data-mp3="../AikGhaltiKaIzala/AikGhaltiIzala-012.mp3">AikGhaltiIzala-012</li>
        </ul>

    </div>

    <hr>

    <div class="foot_container">
        <table width="100%" align="center" border="0">
            <tr>
                <td class="special" width="10%">Love<br/>for<br/>all</td>
                <td class="special" width="80%">Copyright &#0169; 2014 Tarbiyyat Department UK and Terry Mold</td>
                <td class="special" width="10%">Hatred<br/>for<br/>none</td>
            </tr>
        </table>
    </div>

    <!-- All the Scripts here -->

    <script src="allscripts/jquery.min.js"></script>
    <script src="allscripts/jquery-ui.min.js"></script>
    <script src="allscripts/modernizr.custom.js"></script>
    <script src="allscripts/jquery.cookie.js"></script>
    <script src="allscripts/ableplayer.js"></script>

    <script>
        $( document ).ready( function() { 
            new AblePlayer( 'audio1' );     
        });
    </script>

</body>
</html>
terrymold 7 Light Poster

Hi JorgM and Diafol
I have now moved all the js and css files, downloading the one that were linked to, and placed them in a folder aap/allscripts.
I have deleted all references to js files from the <head> section, and just left links to the css files in the <head>
All the links to the js files are now just before the closing <body> tag, and the small script routine follows immediately after the js links.

Now, once again, this script runs perfectly on my Wamp server, but still does not run on our 1and1 server.

I'm afraid I'm at wits end with this. It just doesn't seem logical at all. It just seems as if there is something the 1and1 server does not like?

Is there some way that I can test the script to see if there is a missing file or link?

This player is exactly what we have been looking for for some time, but if I cannot get it to work, I will have to continue my search. So maybe if I give you our rather simple requirements, somebody at DaniWeb might know of something suitable?

We have over 4,500 MP3 audio files (just speech, not music), so we need an MP3 player with an <li> or xml type playlist, and once it has started playing, it should automatically move to the next MP3 file in the playlist. And it would really need to be Open Source, if possible.

But it …

terrymold 7 Light Poster

Hi JorgM
Sorry about all that extra code. I will try loading them in the order you said, and put them near the end of the file.
But I still can't help wondering why it works on my Wamp server, and not on 1and1's server.
Terry

terrymold 7 Light Poster

Hi
I have a problem in which an HTML/JavaScript page, using the excellent AblePlayer Audio Player, which runs perfectly on my Home server (Latest version of Wamp), but will not run when it is uploaded to our 1and1 shared server space. The code for this page is shown below, and when I say it doesn't run online, you see just the HTML <li> list which of course isn't selectable. It is as if the JavaScript code isn't being executed. This is the page code...

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Tarbiyyat Audio Book Player</title>

    <!-- Dependencies -->
    <link rel="stylesheet" href="css/styles.css" type="text/css" />
    <script src="thirdparty/modernizr.custom.js"></script>
    <script src="thirdparty/jquery.cookie.js"></script>
<!-- <script src="scripts/jquery.min.js"></script>
    <script src="scripts/jquery-ui.min.js"></script>
    <link rel="stylesheet" href="css/jquery-ui.css" type="text/css" /> -->
    <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js"></script>
    <script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.9.1/jquery-ui.min.js"></script>
    <link rel="stylesheet" href="http://code.jquery.com/ui/1.9.1/themes/base/jquery-ui.css">

    <!-- Able Player CSS -->  
    <link rel="stylesheet" href="styles/ableplayer.css" type="text/css"/>

    <!-- Additional CSS for Playlist -->  
    <link rel="stylesheet" href="styles/ableplayer-playlist.css" type="text/css"/>

    <!-- Able Player JavaScript -->
    <script src="scripts/ableplayer.js"></script>

<!-- <script src="http://code.jquery.com/jquery-1.9.1.min.js"></script> -->
    <script>
        $( document ).ready(function() { 
            new AblePlayer('audio1');       
        });

<!--     $( document ).ready(function() {
            $( "p" ).text( "The DOM is now loaded and can be manipulated." );
        }); -->
    </script>

</head>

<body>
<div class = "head_container">
        Ahmadiyya Muslim Association<br/>
        Tarbiyyat Department, United Kingdom<br/>
    </div>

    <hr>

    <div class = "main_container">

        <h2>Audio Book Player 01 - AikGhaltiKaIzala</h2>

        <audio id="audio1" class="ump-media" preload="auto">
        </audio>

        <ul class="ump-playlist" data-player="audio1" data-embedded>
            <li data-mp3="../AikGhaltiKaIzala/AikGhaltiIzala-001.mp3">AikGhaltiIzala-001</li>
            <li data-mp3="../AikGhaltiKaIzala/AikGhaltiIzala-002.mp3">AikGhaltiIzala-002</li>
            <li data-mp3="../AikGhaltiKaIzala/AikGhaltiIzala-003.mp3">AikGhaltiIzala-003</li>
            <li data-mp3="../AikGhaltiKaIzala/AikGhaltiIzala-004.mp3">AikGhaltiIzala-004</li>
            <li data-mp3="../AikGhaltiKaIzala/AikGhaltiIzala-005.mp3">AikGhaltiIzala-005</li>
            <li data-mp3="../AikGhaltiKaIzala/AikGhaltiIzala-006.mp3">AikGhaltiIzala-006</li>
            <li data-mp3="../AikGhaltiKaIzala/AikGhaltiIzala-007.mp3">AikGhaltiIzala-007</li>
            <li data-mp3="../AikGhaltiKaIzala/AikGhaltiIzala-008.mp3">AikGhaltiIzala-008</li>
            <li data-mp3="../AikGhaltiKaIzala/AikGhaltiIzala-009.mp3">AikGhaltiIzala-009</li>
            <li data-mp3="../AikGhaltiKaIzala/AikGhaltiIzala-010.mp3">AikGhaltiIzala-010</li>
            <li data-mp3="../AikGhaltiKaIzala/AikGhaltiIzala-011.mp3">AikGhaltiIzala-011</li> …
terrymold 7 Light Poster

Hi Airshow
I've now been able to change my question, so maybe this is the answer you want?
I have a JavaScript Function which gathers the parameters together and outputs a URL via "alert(buildUrl(url, parameters));", like so...

http://localhost/test.php?time1=05:56&time2=07:26&time3=12:57&time4=15:48&time5=18:28&time6=19:58

which is exactly want I wanted. So my question now is that the url doesn't actually open test.php, which will echo the 6 variables.

What do I need to do now to open test.php from this JavaScript funtion? Obviously, if I open test.php from another browser window, the variables are not there!

terrymold 7 Light Poster

I honestly don't know very much at all about what he is doing. When a user uses my script, they enter their postcode in the first section and are then presented with a page which displays these 6 JavaScript variables in a short list in the third section. That part is OK.
The other programmer send a URL with two variables (postcode and a special code) to the middle section of my scripts, The special code just tells my script to go to a special part of my script which creates those 6 variables, but doesn't show any of my code on screen.
As far as I know, the other programmer wants to extract the 6 time variables from my script, and display them on his script as if they came entirely from him.
The main reason I chose to do things this way is that I didn't want him messing with my code, which has happened a couple of times in the past, with dire results.
So that is basically why I don't know or care how he uses those variables. In a recent email from him, he suggested that the variables could be something like this...

"time1":"05:19","time2":"07:09","time3":"12:50","time4":"13:49","time5":"18:30","time6":"20:13"
terrymold 7 Light Poster

That might well be, but don't let it detract from my original question. This "another PHP programmer" works in an entirely different department. All he wants are those 6 JavaScript variables. I am not interested in what he does with them, but they must obviously be in a format he can use.

terrymold 7 Light Poster

Hi everyone
I have a script which contains contains mostly JavaScript. After various bits of user input, it ends up with an array which contains 6 times (hh:mm) and these can be access by times[0] thru times[5]. Obviously these variables would be available on a clients PC.
Another PHP programmer wants to access these 6 variables and use them within his PHP script to display to the user.
What I'm trying to figure out is some way to "present" these variables in such a way that this other programmer can pick them up and do whatever he (or she) wants.
I have had to discard using cookies as you would have to refresh your browser to get access to them, mainly because some of his users wouldn't understand. I have looked at PHP SESSIONS, but I haven't found anything suitable. I have also looked at localstorage and writing the variables to a text file saved on the clients PC.
I believe there is a suitable solution out there somewhere, and I'm hoping that someone on this forum might have an answer.

terrymold 7 Light Poster

Hi. I have a little technical enquiry about PHP that I'm hoping someone here can help me with.
I have a PHP/MySQL application on website A. This app takes a user input, does a few date/time calculations and presents the result onscreen as a series of 6 times.
A friend has another PHP/MySQL app on website B. He wants to send a similar user input to the app on website A, but he doesn't want to run my app on his site, he just wants to just display the result of the 6 times.
In other words, I need to find a way for my friend to enter his user input into my app (website A) and receive the 6 times back on his app (website B) to display however he wants.
I hope this is enough info and that the question makes sense.
Thanks in advance
Terry

terrymold 7 Light Poster

Hi AleMonteiro

That Valums effort looks really great, so I'll give that a try first.

Thanks a lot

terrymold 7 Light Poster

Hi
I'm creating a fairly simple website where a new page would be added every month or so. What I would like to do is create a horizontal menu where a link would be added on the left side of the menu, pushing previous entries to the right.
Eventually, the previous links will "dissapear" off the right of the screen, with the very latest entry still on the left.
But now and again, a viewer will want to read one of the previous pages, so he/she should be able to make the horizontal menu scroll to the left until the desired entry is reached.
In fact, people viewing this website are very likely to want to see entries going back to the first one, and anything in between.
Therefore this horizontal menu should be scrollable anywhere left or right.

Does anyone here know how such a menu could be created?
Regards
Terry

terrymold 7 Light Poster

Panic over!

I used cellspacing = 0px, although not within the CSS, but in the table HTML code.

terrymold 7 Light Poster

Hi
I have a web page that displays rows of records split into 6 columns. To make each line a bit more readable, I wanted to use CSS code to display a continuous border at the bottom of each row. Here is the CSS code:

#timetable-body td {
font-family: 'Comic Sans MS', Arial, sans-serif;
	font-size: 11px;
	font-weight: normal;
	color: #006400;
	background-color: #FFFACD;
	padding: 1px;
	border-bottom-width: 1px;
	border-bottom-color: #400040;
	border-bottom-style: solid;
}

The code works just as one would expect, except it leaves a tiny gap between each column, which I think makes it look tatty.

I tried giving it a dashed style, which more of less "hides" the gap.

But I would really like to have a solid line, right across all of the columns.

Does anyone here know how to do this? Or is it not possible?

Thanks
Terry

terrymold 7 Light Poster

Hi vibhadevit

Could you please explain a bit more exactly what you mean?

terrymold 7 Light Poster

Hi divyakrishnan

I'm sorry, but your last post didn't work either!

It seems to be something to do with the way DIV's work. The logic for the two messages has always been OK, so if you put some text into a div (using one CSS class), and then put some new text into the same div and same (or different?) class, then the new text appears over the first text. So you can't read either!

So I think the CSS part is OK, the PHP logic is OK, so that leaves only the DIV's. So, thinking aloud, I wonder if giving the two DIV's a unique ID will make this work?

What does everyone else think?

terrymold 7 Light Poster

Hi vibhadevit

That works in a sort of way. By that I mean that it seems as though the PHP section (before the HTML) is being parsed before the HTML, even though the user hasn't actually entered anything? So $error is always postcode.

It's getting weirder(?) by the minute.

The HTML is mostly within a FORM, and the PHP begins with pretty standard checks, like...

if (isset($_POST['Submit'])) {
	if ($_POST['Submit'] == "Continue") {

So maybe I should go out and mow the lawn and see if that helps?

terrymold 7 Light Poster

Hi divyakrishnan

Of course that will work, but as I mentioned in my second post, the whole idea of this is to have both messages displayed in the same place. I have tried lots of different things within HTML/PHP, but I just can't seem to get it to remove the first message before displaying the second message.

Maybe I'll have to resort to a bit of JavaScript?

terrymold 7 Light Poster

Hi vibhadevit

That's no good as the two messages are being displayed in different places. It seems as though once you get the first message, it isn't being "erased" when the second message is put on the screen. The idea of using position:absolute was just to put both messages in the same place, but not obviously on top of the other.

Maybe the question I should ask is "How to remove the first message when it's time to show the second message?"

terrymold 7 Light Poster

I have a fairly simple PHP page which is giving me some bother, and I'm hoping someone here can point me in the right direction to correct it.
In the HEAD section there is a bit of CSS...

.messText {
	position: absolute;
	width: 600px;
	top: 250px;
	margin: 0 auto;
	font-family: 'Comic Sans MS', Arial, sans-serif;
	font-size: 14px;
	font-weight: bold;
	color: red;
	text-align: center;
}

Then within the BODY section, at the start is a bit of PHP...

if ($num_rows == 0) {
	echo '<div class="messText">Sorry, your postcode could not be found - Please try again!</div>';
}

And lastly, withing some normal HTML, there is another line of PHP...

<td align="center" valign="center"><br/>
	<?php echo '<div class="messText">Please click on the Continue button below to view your Times.</div>'; ?>
</td>

Now, the whole page is working correctly, except for one thing, and I think it might have something to do with DIV's?

This page has a text input field and a Continue button. It is linked to a MySQL table which contains a list of UK postcodes. The user is presented with this page with the "Please click..." message just above the continue button. If the user enters an incorrect postcode, then the idea is for the "Sorry, your postcode..." message to appear IN PLACE OF the "Please click..." message.

When the page is first displayed, only the "Please click..." message is shown, but when the user enters an incorrect postcode, the "Sorry, your postcode..." message appears on top of …

terrymold 7 Light Poster

Thanks almostbob, but I couldn't get that to work properly. And the more I look at your first solution, the more I like it.

So I think I will stick with that.

Terry

terrymold 7 Light Poster

Hi almostbob

Thanks for such a quick reply. And, so far, it appears to be almost what I was looking for.

There is one thing that would make your solution perfect, although I don't think it is possible, and that for something to make the two buttons invisible instead of "greyed out".

Thanks again
Terry

terrymold 7 Light Poster

Hi everyone

I have a little problem that I'm sure someone here can help me with.

I have a web page with a text input field and a couple of submit button. The user would enter something in the text field and then click on one of the buttons. Each button opens a new page. But all of this is pretty standard coding, so I'm trying to do this a bit differently...

When the user first arrive at this page, the two button are not visible. The user then enters something, which is checked with PHP, using

if (isset($_POST['Submit'])) {
if ($_POST['Submit'] == "Yes" or "No") {
if (isset($_POST['sPostcode'])) $postcode = $_POST['sPostcode'];

Therefore, if the value of Submit is "Yes", then the postcode line is evaluated.

Then, a bit further down, there is this bit of code for the two buttons.

<?php
if ($postcode != "") {
print "<tr>";
print "<td colspan='2' align='left' valign='top' class='labelSect'><br>";
print "<center>Now select either the Left or Right button below</center>";
print "</td>";
print "</tr>";
}
?>

The above code is actually just a message telling the user that the two buttons are now available. Initially, this message isn't shown, but if the user actually clicks either button, the message is shown.

That isn't exactly how I wanted it to work, as I cannot hide the buttons, and the above code will only work if a button is pressed.

I think what I would like to know is, is there …

terrymold 7 Light Poster

Hi mjdodd

Over the past two or three days I have done a couple of Restores, played around with the Bios, checked automatic updates, and yesterday, a Repair Install (again!). And it still wouldn't work. If I had any hair to spare, I would have torn it all out in frustration.

And then I read your reply. It reminded me about a similar problem a few years ago with a friends PC. Thinking that perhaps the hib file might be corrupt or whatever, I looked in the root of C:, but it wasn't there. I searched all my 4 HD's and still couldn't find it. I did a Google for it and found a Microsoft site that had instructions on how to create a new hiberfil.sys. Which I did. And away it went.

The strange thing is what deleted the hiberfil file in the first place? Something must have deleted it without me knowing?

Anyway, everything is OK once again.

So thanks for that reminder mjdodd.

Terry

terrymold 7 Light Poster

Hi

I have an XP Pro PC with SP3. I have all the latest drivers. And everything in Bios and windows itself is setup correctly. ACPI is in S3 mode.

When I want to shutdown the PC, I press the Sleep key, which I have done for ages, and the PC enters Sleep (Standby) mode. There are no lights on the PC, and it looks as if it is actually switched off, which is correct.

To restore the PC from Sleep, I have always pressed the Power button, and within a very short time, the PC is back where I left off previously. Again, correct.

But now, when I press the Power button, the PC seems to go through the exit Sleep process. The PC Power light comes on, the Monitor light come on. The first thing I see on the Monitor is the standard LG message about the video card. That disappears and small message then appears about the monitor being in Standby mode. The screen then goes black and nothing else happens.

To get the PC to work I have to reset it.

This started about a week ago, completely out of the blue. I haven't installed anything new. I have run SFC /SCANNOW but that didn't help.

Does anyone have a clue as to why this is happening?

Thanks
Terry

terrymold 7 Light Poster

I only use Wamp for testing before uploading scripts to my client's server.

My reference to google meant exactly that. Do a google on cURL.

The fact that I'm using Wamp has no bearing at all to cURL.

And as far as I'm aware, by reading stuff on Google about cURL, you CAN download files to your local PC's Hard Disk. But it doesn't do it by Filename, but by URL, hence the name cURL.

Terry

terrymold 7 Light Poster

Hi ardav

As far as I can tell, you can tell it to download the URL or file anywhere, including a local HD.

I use Wamp to do all my testing etc, and you can download a version for win32 or 64 to run locally as well.

But what is even more amazing, it seems to have been around for about 10 years already? And I'd never heard of it until the other day.

There are plenty of googles that will explain everything, and some sites with too much info.

Regards
Terry

terrymold 7 Light Poster

Thanks TySkby and ardav

I suppose that's a new way to describe native files?

Anyway, I know virtually nothing about cURL but at first look it can't be that hard to learn. Especially when I started with ZX81 basic, then CP/M, then Forth and so up through all versions of DOS.

This is the initial statement from my client's host regarding cURL.

cURL is a useful tool designed for sending or receiving files using URL's rather than traditional file extensions. It is available on Linux servers.

And I certainly will do my best to remember to let you know how I get on with cURL. So keep your eyes on this post.

Regards
Terry

terrymold 7 Light Poster

Hi again

Thanks to everyone for your replies, except I would just like to mention to Ardav that the files in question are not RAW files but MP3s.

As I have mentioned earlier, it seems that curl might be the way to go, and the server my client uses supports it, so a bit of testing with curl will be the order of the day for a while.

I'll leave the thread open for a few more days, just in case?

Thanks again
Terry

terrymold 7 Light Poster

Hi there Yy

I forgot to mention that zipping the files isn't an option as the users who will most often use this service are generally computer illiterate, unfortunately.

I'm also just started looking into using Curl, so that could be added to my initial enquiry.

Thanks again
Terry

terrymold 7 Light Poster

Hi everyone

I have over 1500 mp3 files that are available for download on a web site I look after. The files are various sizes and split between 20 folders. One folder has about 600 files.

What the owner would like for his visitors is to be able to select a number of these files, and the click on a Download button. The selected files would then be downloaded to a visitor nominated folder on his/her PC, with no further intervention by the visitor.

Does anyone know how this might be done using PHP and perhaps JavaScript?

Thanks
Terry

terrymold 7 Light Poster

Hi pritaeas

Although the problem in your thread wasn't the same as mine, I was able to determine from it where I had gone wrong.

So, thanks for that. And all is good again.

pritaeas commented: Kudos ! +7
terrymold 7 Light Poster

Hi

I have a PHP page with the following JavaScript and HTML Form, but when I click on the Continue button nothing happens. The action="this_page.php" means that when the Continue button was pressed, prior to adding the Validation bit, would run itself as there is quiet a bit of PHP code at the top of the page.

JavaScript

<script type="text/javascript">
function checkForm() {
	alert('You have arrived at the Function!');
}

HTML Form

<form onSubmit="return checkForm()" name="form" class="form" method="post" action="this_page.php">

If I take out the "onSubmit" code, the script works as it always did. So does that mean that you cannot have an "onSubmit" as well as an "Action" in the form header?

The reason for the validation is that the form has three sets of Inputs (See my previous post) so the JavaScript is need to make sure that there is data in only one input.

Then the PHP code is run, and of course, and what happens depends on what the user has input.

So what I would really like to know is how I can get JavaScript to check what the user has input, and then do the "Action" bit so the PHP can be run.

At the moment, as I have said, when I click on the Continue button absolutely nothing happens. The form just stays as it was.

Thanks

terrymold 7 Light Poster

Hi minigweek

Could you please show me an example?

terrymold 7 Light Poster

Hi again

I have an HTML form with three groups of inputs. These inputs are all text. Group 1 has 1 input, group 2 has one input, and group 3 has 3 inputs. What I would like to do is this...

If a user inputs any data into a particular group input, then entry to the other 2 groups will be blocked.

I'm assuming that this can be accomplished with JavaScript?

Thanks in advance.
Terry

terrymold 7 Light Poster

Hi again Ardav

Sorry about that. I guess I didn't examine your answer enough?

I can see where you're at now, and I will give it a try and let you know how I get on with it.

Thanks again
Terry

terrymold 7 Light Poster

Hi Ardav

I'm afraid that you've misunderstood what I wanted, but you might be on the right track anyway.

It isn't how to do the calculations that I want. I've already done them and they work fine. The two times I had in my original post were just examples.

What I need is to somehow put ALL my calculation code, which is about 50/50 PHP and JavaScript, into or in place of the "Hello" in my onclick line.

So, if I were to click on the button, the text in the example div will be replaced by "Hello". But what I want is to see the RESULTS of those calculations in that div instead.

Maybe I'm not explaining it properly? So ask whatever if you're still not sure.

Terry

terrymold 7 Light Poster

Hi everyone
I need a bit of help with a problem involving HTML, JavaScript and PHP which I'm hoping someone here can help me with.

I have a working PHP script which uses a FORM section to get data input, which actions itself to do some PHP and JavaScript calculations etc, and it then opens a second PHP script to display the results. Now, all of this works perfectly, or at least how it was originally designed.

What I am trying to do is to do away with the second PHP script, and display the results (of the calculations) within the same page.

I have found a bit of code which will probably do what I want, but I just need a bit of help. This is part of the code...

<FORM method="POST">
   <div id="example">
      <P>This text is already in the DIV</P>
   </div>

   <input type="button" name="name" value="Hello" onclick="document.getElementById('example').innerHTML='<p>Hello</p>'">
</FORM>

When this is run, it's obviouse that the text "This text is already in the DIV" will be magically replaced with "Hello".

What I would really like to know how I can get a 2 or 3 hundred line PHP/JavaScript section of code, mostly complex calculations with an output basically consisting of 6 times (05:35 08:49 and so on) into the onclick above where the Hello is?

For example, could I put all the calculations into a function or something similar, and put just the function call where the Hello is?

Or maybe there …

terrymold 7 Light Poster

Hi Setvir

I had a look at your code and the examples and whatever on your link, but unless I am missing something radical, I cannot see how that script would allow the simultaneous or sequential download of say 10 files?

Perhaps if you were to explain a bit more?

Terry

terrymold 7 Light Poster

Hi everyone

Does anyone know of a PHP solution, or even a HTML solution, whereby a visitor could select a group of about 10 files (out of a couple of thousand!) and then click a "Download" button to download the selected files onto his/her PC?

There is one solution I've come across and that is to Zip the files first, but that would be far too complicated for my users.

Thanks in advance
Terry

terrymold 7 Light Poster

Hi again Airshow

Whew! It all sounds a bit complicated just to determine whether or not BST is in force or not>

But I'll give it a try and see what happens. And then I'll get back to you with a result or a few questions. Whichever comes first?

Thanks
Terry

terrymold 7 Light Poster

Hi Airshow

At the moment, the summertime variable is created within PHP. It uses "today's" date to decide. The result, 1 or 0, is then passed to a JavaScript routine which uses that information to display a set of times for today, depending on whether it is BST or not.

Then the user can click on the Yesterday or Tomorrow button which then adds or subtracts 1 day from today. This is also done with JavaScript, and a range of times is again calculated. But the day used will either be Yesterday or Tomorrow, so the PHP summertime variable is no longer valid, and I don't see or maybe don't know how it can be changed. JavaScript is obviously running locally while PHP runs on the server and that has already happened.

I suppose that begs another question? Can I re-run the PHP include file again? And if so, how?

Thanks
Terry

terrymold 7 Light Poster

Hi everyone

I have developed a PHP page which uses a few JavaScript functions and other JavaScript code to initially display today's date (and plus other data as well!). At the top of the PHP script is a PHP include file which determines whether or not today is BST - it creates a variable set to 1 if it is and 0 if it isn't. Pretty straight forward and it works as well.

This variable is used in the JavaScript to control what is output, depending whether or not BST is operating.

At the bottom of the PHP script is a bit of HTML which produces two buttons, with links to JavaScript functions. These buttons are named Yesterday and Tomorrow, and it shouldn't be too difficult to work out what they are used for.

These two JavaScript functions perform identically but with data for Yesterday or Tomorrow.

And this is the problem. When the script is first run, the BST test works as expected. But if a user clicks on either of the buttons mentioned above, the BST code is ignored because the variable originated from PHP and it has already been parsed.

So my question to all you clever JavaScript gurus is this....

Is there a simple, or complicated, JavaScript code that will determine whether or not BST is currently in force, and output a similar 1 for yes and 0 for no?

Thanks in advance
Terry

Part of …

terrymold 7 Light Poster

Hi again

Well, I'm happy to say that the two answers supplied by chrishea were absolutely spot on.

So thanks very much chrishea for that.

And let's not forget paulrajj. His answer was an interesting variation on the first answer from chrishea.

Once again, thanks to all.
Terry

terrymold 7 Light Poster

Hi and thanks chrishea

That solves the second problem just fine, But I still haven't been able to insert the $Datevar into the first part of $timestamp = strtotime('$datevar here! 07:08:00');.

I expect it will be as simple as your response, but it's completely elluding me at the moment.

Thanks again
Terry

terrymold 7 Light Poster

Hi everyone

I have a PHP Class file (salat.times.php) that accepts a few User Inputs, one of which is a Date in the format dd-mm-yyyy. The date is used for a part of the class and is fine.

In another part of the class, there are a number of Time outputs with the format hh:mm.

Now, there two of these dates that I cannot seem to get precisely how I would like.

Time 1 is 05:17
Time 2 is 07:08

What I am trying to do is to have Time 1 equal to Time 2 minus 90 minutes, and obviously still be in the same hh:mm format. In the above example, Time 1 would become 05:38.

I have been experimenting with PHP Timestamps, but I'm finding it difficult converting things backwards and forwards.

For example if I create a timestamp manually, like

$timestamp = strtotime('06-10-2010 07:08:00');

I get a timestamp of 1286348880. And if I subtract 5400 (90 minutes worth of seconds), I end up with a timestamp of 1286343480.

But with this I am having two problems.

1. How can I get a Date variable into the strtotime() part?
2. How can I get the converted timestamp back into the time format hh:mm?

As usual, some really expert advice will be hugely appreciated.

Thanks
Terry