Jump to content

iwato

Members
  • Posts

    1,506
  • Joined

  • Last visited

  • Days Won

    4

Posts posted by iwato

  1. As I feared, this will likely not be easy.  Here is all that comes before the <?php tag.  I have scrutinized the invisibles of all lines before the tag.  All lines end with line breaks and begin with either tabs or nothing.  Of course, there are blank spaces within the lines of code, else the code would be unintelligible.

    <!DOCTYPE html>
    <html lang="en">
    <head>
    	<meta charset="utf-8" />
    	<title>Gate Seven - An Invitation and Gift</title>
    	<meta name="generator" content="BBEdit 11.6" />
    	<link rel="stylesheet" href="../../_utilities/css/gc_splash.css">
    	<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
    	<script>
    		$( document ).ready(function() {
    			console.log( "ready!" );
    			var tongue = 'other_tongue';
    			$('#other').hide();
    			$('#tongue').change(function() {
    				if ($('#tongue').val() == tongue) {
    					$('#other').show();
    				}
    				if ($('#tongue').val() != tongue) {
    					$('#other').hide();
    				}
    			});
    		});
    	</script>
    </head>
    <body>
    	<?php

     

  2. DISCLAIMER: After seeing what has been written on the internet on this subject I am loathe to start here, but have I any other choice?

    QUESTION:  The PHP header(location: './sample.html'); is telling me that my headers have already been sent and is referring me back to the beginning of my PHP script.  Can I buffer my way out of this mess?  If so,

    • Where to I start and stop the buffer?
    • Where do I place the header( ) function?

    BACKGROUND:  I have just spent several weeks setting up an email verification system and am putting on the decorative touches.  Truly, I thought that I had almost reached the end; truly I fear now that I am far from finished.  I hope that I am wrong.

     

  3. May I suggest that you limit your issues to one at a time and only post the code necessary to illustrate the particular issue in question.

    It would greatly encourage other users to respond to your questions -- well, at least me, at any rate.

    I do not want to pretend to speak for everyone.

    Roddy

     

  4. I do not have time to provide you with a complete solution, but I do have a question that might spur you to a different routine.

    QUESTION:  What is causing myIndex++; to advance? Or, in other words, how are you calling carousel( )?

  5. Thank you for the code, but I am baffled by this statement:  "I would discourage the use of HTML attributes for events, ...".  It would appear to me that HTML is as close to the document that you can get, so why step away from it?  Yes, it must be true that each browser has its own way of dealing with HTML events, but surely this kind of event is so very basic that one should have little fear of variation across browsers.

    Also, so long as the event is not triggered before the entire document has loaded, why can the onchange event not find it?  Is it the absence of an event handler, or is it the presence of the ready( ) function?  I asked this because the element <input id='other'> is, indeed, hidden when the document opens.

  6. <head>
    <script>
      $( document ).ready(function() {
          console.log( "ready!" );
          $('#other').hide();
          function otherTongue() {
            if ($('#tongue').val() == 'other_tongue') {
              $('#other').show();
            }
          }
      });
    </script>
    </head>
    <body>
      <form>
          <select name="tongue" id="tongue" size=4 onchange="otherTongue()" >
              <optgroup label='Oceania'>
                  <option value=mi>Maori</option>
                  <option value=haw>Hawaiian</option>
                  <option value=sm>Samoan</option>
              </optgroup>
              <optgroup label='Not Listed'>
                  <option value='other_tongue'>Other Language</option>
              </optgroup>
          </select>
          <input type='text' name='other' id='other' />
      </form>
    </body>

    Why do I am receiving the error message:  "Can't find variable otherTongue( )"? 

  7. Dsonesuk:  That was not a typo.  I placed the blank purposefully so that the brackets are easier to read.  I do understand how someone could misunderstand, however.  Next time I will make a note of the insertion so that there is no confusion.

    Ingolme:  You are correct.  The notion of scope did come across my mind as I was writing the code, but the code worked, so I ignored any further discussion.  Besides, it looked nice .... :-)

    Janitor:  There are two different variables with the same name, but there are also two different addresses:  one outside of the function, and one inside the function.  If you Google for the city of Paris, you will discover one in Kentucky, USA and one in France.  Who knows?  There are probably more.  In any case, each has its own address.  

    This said, each variable is initialized:  one with no content outside the function, and one with content inside the function.  

    The principle is the same as I what I wrote in my previous entry:  pprovide a name and variable type (the kind of content that you can store in the room), and Javascript assigns an address.  This is initialization!

  8. OK.  I have tried what you suggested, and this was the result.

    Firstly, I am not using PHP mail( ) per se; rather, I am using PHPMailer.   Thus, I was not able to include the message where you suggested.

    Secondly, if I use ob_end_clean( ), nothing happens.  If I use ob_end_flush( ); however, I can at least get the file with the desired value to appear on the form page that sends the message, but not in the sent email.

    Any suggestions?

  9. Dave, I have not tried it and will take your word for it.

    Important for Junitar is that he understands the notion of initialization.

    For example, in the following code
     

    var myvar = [];
    function doSomething(input1, input2) {
      var myVar = [input1, input2];
      alert (myVar[0]);
    }
    doSomething('a', 'b');

    the statement

    var myVar = [];

    initializes the variable myVar by providing a name and variable type.  Javascript provides the address.

    The same is true for PHP; simply the syntax is different.  I cannot speak on behalf of other languages, but is it not likely that all object-oriented languages operate on a similar principle?

     

  10. 2 hours ago, Junitar said:

     

    Quote

    Thank you to you both for your thorough feedbacks. 

    You are welcome!

    Quote

    If I write:

    
    $test['letter1'] = 'a';
    $test['letter2'] = 'b';
    Quote

    my array is well declared and ready to be used without being initialized using $test = [].

    You initialized the variable $test with the first statement -- namely,

    
    $test['letter1'] = 'a';

    1) You gave your storage room a name -- namely, $test.
    2) You assigned to the room a certain kind of content -- namely, that of an array $test [...].
    3) You placed content -- namely, 'a' -- in the first box of the array and named the box 'letter1'.

    Because you performed items 1) and 2) PHP created an address for your room.  This is called initialization.
    Because you gave the first box of your array a name, you have created a special kind of array called an associative array.
     

     

  11. First of all, you should understand that a variable is little more than a name for content that can vary, and that this content comes in several prescribed forms called types.  An array is simply one of these variable types. In effect, a variable is simply a reference for changing content.  

    A variable is like a storage room with an address.  It is a place where content is stored -- content that can be easily found, replaced, modified, or utilized when called upon.  When you initialize a variable, you declare the existence of a storage room and give it an address.  You can fill it at the moment you declare it, or you can leave it empty.  It is up to you.

    By initializing all of your variables at the beginning of your routine they are ready to go.  What is more, they serve together as an outline of what your routine is about, because it is variables that contain your input and output.  After all, the whole purpose of a routine is to modify input in an effort to produce some desired output.

    You might even want to organize your initialization strings in groups:  input variables, processing variables, and output variable.

    Roddy

  12. Great! I just reviewed how to use buffering.  My first real application!  I am excited.

    Could you please provide me with a brief work flow to help me get started?  What get's buffered?  And, where should the include() take place? 

    By the way, Ingolme, I am very happy that you responded and to see that you you are still with W3Schools.  It has been a very, very long time!

    Roddy

  13. BACKGROUND:  I am setting up an email verification routine that receives $_POST data from a form and sends a confirmation email to the applicant with a verification link.  The form and the PHP processing routines that store the $_POST data in a MySQL database, and that send out the confirmation email in text format are contained in the same document.  The HTML formatted confirmation email is contained in an external file and is included using the following PHP-Mailer method: 

    				$mail->msgHTML(file_get_contents('../../confirmation_mail.html'), dirname(__FILE__));

    GOAL:  Include in the external HTML file information obtained from the $_POST variable before the email is sent.

    WHAT DOES NOT APPEAR TO WORK:  I have tried placing statements similar to

    <?php echo "blah, blah, blah" . $variable_name . "blah, blah, blah"; ?>

     in the external file in the hope that the value of $variable_name would be read into the file before it is sent.  Unfortunately, this does not work. 

    ANY SUGGESTIONS?

  14. In effect, you have the following scenario:
     

    Object prototype => Person prototype => Person object                   

    Inheritance:  The Person prototype inherits from the Object prototype

    No inheritance:  The Person object has access to what is inherited by the Person prototype from the Object prototype and part of that inheritance includes use of the DELETE keyword on the properties of the prototype from which the object was created.

  15. Quote

    I assumed that because "age" property is in the "Person" object prototype, then the myMother object would "inherit" the "age"  property. So... with reference to your last comment, I must be misunderstanding the "inherit" thing.

    I believe, but I am not certain, that inheritance refers only to properties and methods passed from one class (prototype function) to another.  An object is not a class.  It does not inherit (using the term loosely in this context) in the same way that a class does.

    Making more practical sense of what I just stated.  The object allows you to perform certain operations on the constructor function from which it was created, but does not allow you to mess with any of the properties or methods that the constructor function inherited from the Object class that allowed you to produce the constructor function.  

    Surely delete is an inherited method from the Object class that allows you to perform certain operations on the class from which your object was created.

  16. Wow... well, best of luck of with getting help from others. I can only hope you treat them with a little more respect then you do / did those around here.

     

    Respect is something to be earned. It is not something to be taken for granted. This applies to both the teacher and the student.

    Are you some sore of elected official that you can speak on behalf of the entire forum? You are obviously very supportive of JSG.

  17. I read it as well as I could. When you said this: What does "two" refer to? Does it refer to config.nice files? Complete Apache installs? I don't know, it's ambiguous, so I asked. If I ask a question that means I did not get the answer from what you already wrote, so instead of just quoting yourself you should explain what you meant. Don't come back with "you should read carefully" as if you explained everything perfectly well the first time. If I'm asking a question then there is obviously a disconnect. And now we're talking about this instead of addressing your actual issue, which isn't helping anyone. If I ask a question, it's because I don't know the answer and I'm looking for clarification, not a copy and paste of what you already wrote. If what you already wrote was clear enough then I wouldn't have asked the question. That's not my experience. We run several dedicated servers on CentOS, and all of them have a single Apache installation location with a config file that creates individual sites and document roots, and none of those document roots has an additional Apache directory inside them. There is only one Apache installation directory on each server. I have no experience with MacPorts specifically and can't tell you how it works, but each of our Linux servers has a single location for the Apache installation. It sounds like you're asking how MacPorts works, and I can't answer that, I don't know what it did when it installed Apache. This is what the Apache manual says: Emphasis is mine. It sounds like the www directory is neither a build directory nor the root of the source, it sounds like a document root.

     

    I am sorry that you are so easily confused and will let the others judge your command of the English language. My purpose is to understand the nature of my file structure and how to implement the config.nice file. In any case thank you for your effort. I will redirect my question to the MacPorts people. Hopefully, they can offer a clear explanation.

  18. Well, ok then. It sounds like you have one version of Apache installed inside the web root of another version of Apache. Hopefully that answers your question as to why you see 2 folders for Apache.That sounds like you have 2 config.nice files, not 2 complete Apache installs. I'm not trying to be dense here, I'm trying to help you with your questions. You could help me by not answering with sarcasm.

    Quoting myself is not sarcasm. It is an alert to you to read my questions well before replying. It will save us both, and anyone else who is interested, a lot of wasted effort. Please try not to be defensive.

     

    Well, ok then. It sounds like you have one version of Apache installed inside the web root of another version of Apache. Hopefully that answers your question as to why you see 2 folders for Apache.

    I do not believe this to be true, as I recall a similar option (local and www) offered in the MAMP Pro user interface. The configuration that I have now appear to have been automatically created by the MacPorts installation. Furthermore, based on my previous experience with MAMP Pro, it appears to be a standard file system on UNIX-based machines.

     

    That sounds like you have 2 config.nice files, not 2 complete Apache installs.

    Yes, this does appear to be the case. The question is why, and how should they be employed for their apparent designated purpose -- minor upgrade installation of the httpd server?

×
×
  • Create New...