Jump to content

Don E

Members
  • Posts

    996
  • Joined

  • Last visited

Everything posted by Don E

  1. Hello everyone,Today I uploaded some files to an actual server for "live testing" and I got the headers already sent error. I know why this happens but I wanted some suggestions on what to do when you want to redirect a user to another page IF all is well to send them to another page? For example: $img->uploadImg(); if(!$error = $img->checkError()){header('location: page.php');}else{echo $error;} I wasn't getting any errors on my home server because output buffering is set to 'On' in php.ini file and 'Off' the 'live server'. What would some of you suggest? Turn on output buffering in php.ini file on live server or instead have ob_start() and ob_flush() for each page when necessary?Also, if it's suggested to do just do it in php.ini, would it be wise to turn it 'On' by having a value instead like so: output_buffering=4096Thanks.
  2. This is a good reference: http://cplusplus.com/reference/
  3. I'm not entirely sure, but depending on what IE your checking the results with, if it's ie8, then it may be because of what's described here: http://yyosifov.blogspot.com/2009/03/getelementbyid-compared-in-ie6-ie7-and.html Maybe not, but I'd thought post this because I came across a similar problem not too long ago and the site helped me understand what was going on.
  4. C++ has libraries(classes you can use) but you have to include them for whichever task you want to perform in your program. For example: #include <string> You will have access to the 'string' class, its methods and properties to perform string manipulations. Example: string str = "Hello"; cout << "The length of str is " << str.length() << " characters.\n" // outputs: The length of str is 5 characters.By including, you tell the compiler what to work with. What I noticed about C++, it's very strict. The compiler needs to have/know everything about what you're doing in the program. Unlike other languages like PHP where we don't have to do an include for string manipulation for example, it's already built in. If we didn't include the string class above though, the compiler would of gave an error even though the 'string' type/class is part of C++(meaning it part of it's 'library'), but for each program we make, we have to include it.
  5. onfocus="this.value=''" Example: <input type="text" name="search" value="Search..." onfocus="this.value=''">
  6. Don E

    Is this legal/correct?

    So it basically boils down to using Ajax to send data/info from JavaScript to PHP? I was trying to come up with a way by taking a short cut without having to use Ajax just to get that small bit of info to PHP.
  7. Don E

    appending id

    Thanks for clarifying. When I saw document.getElementsByTagName('h1')[0].nodeName; it looked unfamiliar(saw it in XML recently though) to me as I normally do this instead with that method to access the individual elements :ie: var div = document.getElementsByTagName('div'); div[0].innerHTML = "Hello"; div[1] innerHTML = "Hello again"; etc
  8. Don E

    Is this legal/correct?

    When I echo after doing this: $_SESSION['screenWidth'] = '<script type="text/javascript">document.write(screen.availWidth);</script>';, the width of my screen is displayed. Thank you for the tip on intval. I figured the string '<script type="text/javascript">document.write(screen.availWidth);</script>' is being stored there, but for some reason when echoing $_SESSION['screenWidth'], it displays the width of my screen and not the actual string.Even doing this gives me what's intended: $_SESSION['alert'] = '<script type="text/javascript">var num = 5; alert(5);</script>';echo $_SESSION['alert'];
  9. Don E

    appending id

    I'm not too familiar with XML. So then basically this is correct: document.getElementById('here')[0].appendChild(div); ?
  10. Don E

    Is this legal/correct?

    For me when I try to do some basic arithmetic for example, I don't get any results at all(as intended). echo $result = $_SESSION['screenWidth'] + '6'; // I put 6 as a string since the type for $_SESSION is string, but even when cast them to integers, still no results as intended. echo $result = (int)$_SESSION['screenWidth'] + 6' Edit: Yes I'm aware you can do this: echo $result = '5' + 6; //outputs 11. Because of the above not working, I thought it had to do with the type having to be equal, so that's why I had the 6 as a string: '6'
  11. Hello everyone, Is this considered legal and/or even correct: $_SESSION['screenWidth'] = '<script type="text/javascript">document.write(screen.availWidth);</script>'; Thanks.
  12. Don E

    Next step?

    You can show a table, that's in a database. You can run a query that displays the whole table: SELECT * FROM tableName;Then you can take the results from that and 'show' it on your website. You can even put(format) it inside a HTML <table>.
  13. Don E

    appending id

    Just to add: This document.getElementsByTagName('body')[0].appendChild(div); .. looks like it would be for XML accessing of elements. Ie: x = xmlDoc.getElementsByTagName("title")[0].childNodes[0].nodeValue;
  14. I understand completely. I was just stating in general the perspective he probably was coming from.
  15. It looks like he was hoping/wanting to get an overall estimate price for the project based on what he said in the first post despite having to calculate the hours etc; ie "Yeah about $500-700 dollars should be a good price to offer." Some years ago I had a small landscaping business and the clients always wanted to know price before hand no matter what and I would express to them sometimes that I cannot give you a definite price without first seeing your property etc, but they always insisted on giving them an 'estimate' at least anyway. It kind of seems like He's in the same boat with these potential clients and they want an answer fast despite having to calculate everything.Just my two cents.
  16. Sometime ago I made something you're referring to for experimenting reasons. I attached it so you can download it and open it in a browser. I recommend a updated browser like Chrome or Firefox. To check out the actual code, just open it in your favorite text editor.Appearance wasn't my objective so don't wonder about that. I don't have the form going to anything, but if I did, it would be Ajax/PHP. Other than that, if you're wondering how to get the effect of dimming the background and the log-in popup box fades into view, hopefully this will give you an idea. It's not perfect, but you'll get the idea.(that's if, that's what you're looking for)popup.html
  17. boen, Did you add this for added security? '$2a$31$' Edit: Explained above.
  18. If you're wanting to grab that specific only, you don't need to have the loop.
  19. JSG and/or Boen,Can either of you or both provide an actual working example of the above procedures/methods? Meaning, from the the time the user chooses a username/password and submits to be inserted into a database; the procedures between those two points in the methods described above. I would greatly appreciate it.Thank you!
  20. Don E

    php mysql insert

    If you're going to be making queries throughout the page, probably best to have it at the top then. In your case with the example, it would be okay to have it right before the query. Actually, its not a bad idea to have it after once all the form data is filled(meaning, once it clears validation; the if statements checking if the $_POST's are empty or not) and ready to be uploaded to the database.
  21. Don E

    php mysql insert

    For the collection of if statements, I would recommend using the empty() function instead: if(!empty($_POST['firstname'])){ $firstname = ($_POST['firstname']); $firstname = mysql_escape_string($firstname); $error_string = ''; } You can actually check them all at once in one if statement like so: if(!empty($_POST['firstname']) && !empty($_POST['lastname']) && !empty($_POST['phone']) && !empty($_POST['message'])){ // set your variables here and query database since all fields are NOT empty and contain values that are not equal to NULL and/or 0 (zero)}else{ echo 'Please fill in all fields!';} empty() is good because it checks to see if the value is not null. isset() checks to see if a variable has been set, and it if its set to zero 0, it still still considered 'set'. If a variable is set to 0 when using function empty(), it's considered 'empty'.
  22. Don E

    Echo?

    Eduard, since Dutch is similar to German(I heard/read), can you understand this then: http://www.php.net/manual/de/ It's the PHP manual in German.
  23. Are you saying it doesn't send this one: $sent2 = mail($from, $subject2, $autoreply, $headers2); It maybe because $from is nowhere to be seen in the code not unless I'm not seeing it.
  24. Don E

    Next step?

    Basically. insert.php wasn't receiving the data because $_POST array wasn't receiving the data. (because the name attribute from the input field(s) didn't match to $_POST array labels(index keys): ie: $_POST['site_name'])
×
×
  • Create New...