Jump to content

iwato

Members
  • Posts

    1,506
  • Joined

  • Last visited

  • Days Won

    4

Everything posted by iwato

  1. iwato

    The header( ) Function

    If the problem is within the PHP code, then would this not be a likely source? Specifically, the first line. For, the file confirmation_mail.php contains headers. $html_message = file_get_contents('../../confirmation_mail.php'); $html_message = str_replace('%username%', $name, $html_message); $html_message = str_replace('%email%', $email, $html_message); $html_message = str_replace('%hash%', $hash, $html_message); Could I find a better place for it? I think not. Could I buffer it? Surely, but I am not sure how. Surely the email that PHP sends on the sending page must be sent before the header( ) function is invoked else the PHP on the sending page would fail, would it not? Surely, the document confirmation_mail.php must be included in the document before it is sent, else it would be omitted from the mail, would it not? I do not see how to get around this problem, if it is, indeed, it is its proper source. Roddy
  2. iwato

    The header( ) Function

    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
  3. 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.
  4. iwato

    PHP contact form

    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
  5. Yeah, I already thought of that, but then I cannot mix the images up randomly, unless I create a bunch of multiple-image images. I would rather write code, as I learn by doing it. It is a better investment in time and output. No other ideas?
  6. Is it (see title) possible? If yes, how? If not, do you have another suggestion to obtain a similar effect. CONSTRAINT: This is for an HTML formatted email, and I must avoid elaborate coding.
  7. 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( )?
  8. As I still could not get it to work, I explored further on the net and came up with this very happy solution at stack overflow. $html_message = file_get_contents('../../confirmation_mail.php'); $html_message = str_replace('%username%', $name, $html_message); . . . $mail->msgHTML($html_message); No buffering required.
  9. Got it. There are three aspects to take into account in a web page: Content: HTML Presentation: CSS Behavior: Javascript And then, there are HTML formatted email messages. In any case, I will try to be more assiduous.
  10. 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.
  11. <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( )"?
  12. 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!
  13. 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?
  14. 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?
  15. You are welcome! $test['letter1'] = 'a'; $test['letter2'] = 'b'; 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.
  16. 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
  17. 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
  18. 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?
  19. 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.
  20. 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.
  21. Might it be that you have not created a prototype? What you have done is created a function. This might be a good starting point.
  22. Just wanted to say, "Hi".  It has been a long time.

    Check the Item CREDITS in the navigation menu at grammarcaptive.com

    You will probably like what you see.

  23. 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.
×
×
  • Create New...