Jump to content

Don E

Members
  • Posts

    996
  • Joined

  • Last visited

Everything posted by Don E

  1. Don E

    SELECT MYSQL

    Not sure what you're asking, but just to note... it is recommended for session_start() to be declared at the top of your file(s)/document(s) after the php opening tag <?php and before any HTML. <html>
  2. Check out this link.. might give you an idea: http://w3schools.invisionzone.com/index.php?showtopic=43494
  3. Fixed the problem. I had a naming conflict within the root directory. Thanks for your input JSG.
  4. Hey everyone, I was wondering if it's possible to do a mod_rewrite for form POST/action urls?For example:<form method="post" action="page.php"> .............</form>Here's what I have: Options +FollowSymlinksOptions -IndexesRewriteEngine OnRewriteRule ^([a-zA-Z]+)\/?$ $1.php [nc,l] For the form, instead of the action being like how it is above, can I have it like this: <form method="post" action="page/"> .............</form> But when happens when submitting the page, it does/goes to this: http://localhost/testsite/page/page.php'>http://localhost/testsite/page/page.php Is it possible to get it to show/go to http://localhost/testsite/page/ (which is actually http://localhost/testsite/page.php)? Thanks.
  5. http://www.w3schools.com/cssref/pr_text_text-align.asp
  6. You can use CSS to target an element/tag and apply text-align: center; to it. The "align" attribute was deprecated in HTML 4.01, and is not supported in HTML5.
  7. Maybe because you subscribed to follow this thread to receive notifications when there are new posts?
  8. Figured out what the problem was... I originally started out in notepad++ with everything and transferred over to dreamweaver(only use it in code view) once my copy of notepad++ was acting up(http://w3schools.invisionzone.com/index.php?showtopic=43320&view=findpost&p=239536) . I was certain I saved the file(s) as utf-8 without bom in notepad++. So now in dreamweaver when doing what I mentioned above about opening a new file, then copying and pasting and saving, low and behold, it works. DW's default(well my version) setting for a page is utf-8 without BOM but gives you the option when saving if you want BOM. If you want BOM all the time, you can go into the settings and set it to automatically to include BOM when saving. (just stating, probably not a good idea ) Once again, thanks for everyone's input! Much appreciated!
  9. I am completely aware of what Fox mean't. Before I post questions about anything, I usually do a search on the problem I'm experiencing. I read about all the causes that the problem I'm experiencing can be from tabs, spaces, etc etc, UTF-8 with BOM. I'm aware of this. Yes the page above is called page.php. The above code is at the very top of the page, just the way you see it above. No, not confused session_start() with ob_start(). I was going to make a new thread about this issue but I decided to just post to this thread. Completely disregard the ob_start() but as stated in the first post, the reason why I wasn't experiencing this problem before was because on my home sever(wamp), output buffering was set to 'on' in php.ini. It was until I loaded to a testing live server that I noticed the problem because on the sever, output buffer is off in the php.ini. I went and turned off output_buffering on my home server. Not sure why wamp has it enabled when installing wamp for the first time. You said using sessions isn't good either, can you suggest another way then to pass information from page to page about a user that isn't required to last for a long time? BTW, disregard the first post with the header redirect. In post 3 I mentioned I made some changes. The code in post 1 was on another page, and if all is correct(no errors), then go to page.php(hence the redirect). So I thought why have the form submit to itself like it did in post1, but instead have it submit to page.php to get rid of the header statement thus fixing the header error I was experiencing at first when I first made this thread. But low and behold after doing all that, I am still experiencing the header sent issue. There are no tabs, spaces, etc anywhere before <?php opening tag. I'll even go ahead and make a new file, make sure it's UTF-8 without BOM and see if that fixes the problem, but at the moment I am certain the current file is UTF-8 without BOM. I'm sure it's something simple that's causing this but can be frustrating. Thanks for your input.(everyone's as well!)
  10. Yes file is saved as UTF-8 without BOM. From what I can tell/see, there are no spaces, tabs, line break anywhere before session_start(); I even went to some of the other pages and commented out session_start() in case for some reason it was conflicting with the page above and still get the same error. In other words, from all the pages in the directory for this site, the page above is the only page that has session_start() at the moment.
  11. I did some changes and I am still getting the error. The following code is at the very top, before any output of html: <?phpsession_start();include('imgUpload.php');include('page_template.php'); $imgName = trim(str_replace(' ', '',$_FILES['img']['name'])); $imgType = $_FILES['img']['type']; $imgError = $_FILES['img']['error']; $imgTemp = $_FILES['img']['tmp_name']; $imgSize = $_FILES['img']['size']; $img = new uploadPic($imgName, $imgType, $imgError, $imgTemp, $imgSize); $img->uploadImg(); if($error = $img->checkError()) { $displayError = new page_template(); $displayError->__set('title', 'Error | site.net'); $displayError->__set('content', '<p>' . $error . '</p>'); $displayError->Display(); exit(); }?><!doctype html>etc.... This is the error: Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at C:\wamp\www\site\page.php:1) in C:\wamp\www\site\page.php on line 2 BTW: the includes files don't have session_start();
  12. When you created the paragraph, you have newLink as the var name. When you go to set the attribute, you have newlink(L is not cap). Try changing that and see if it works.
  13. Thanks boen and birbal once again. Great suggestion birbal. Have a better understanding.Oh, just to make sure.. All this also applies to HTML DOM correct?
  14. You're welcome! Glad you find it useful.
  15. Don E

    PHP Pear question

    Hey everyone, I installed Pear on my wampserver and I don't think I have the include_path set correctly in the php.ini file because when I do this: include('Mail.php'); // email address here are just dummy address for this post $mail = Mail::factory("mail"); $headers = array("From"=>"me@example.com", "Subject"=>"Test Mail"); $body = "This is a test!"; $mail->send("name@mail.com", $headers, $body); I get an error telling me no such file is found etc. I went into the include path in the php.ini file and did this:; Windows: "\path1;\path2"include_path = ".;c:\php\includes;C:\wamp\bin\php\php5.3.8\pear\PEAR;" but I'm still getting the same error. (Yes I restarted all wamp services as well) Maybe I did that incorrectly or I installed pear wrong. Any input is greatly appreciated. Thanks!
  16. Hey, one way would be to use JavaScript. To get an idea of how that would look, check out the following: <!DOCTYPE HTML><html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><title>Slide Show</title><style type="text/css">body {text-align: center;margin: 0;padding: 0;} #imageContainer {min-height: 550px;background-color: lightblue; } a {text-decoration: none;padding: 5px;color: #333;}</style> <script type="text/javascript"> var imgSlide;var pic = 0;window.onload = function (){ imgSlide = document.getElementById('img'); // preload imagesimages = new Array();images[0] = new Image();images[0].src = "waterfall-0.jpg";images[1] = new Image();images[1].src = "waterfall-1.jpg";images[2] = new Image();images[2].src = "waterfall-2.jpg";images[3] = new Image();images[3].src = "waterfall-3.png"; } function slide(){imgSlide.src = images[pic].src;if(pic < 3) // images.length - 1 can be used here{pic++;}else{pic = 0 }timer = setTimeout(slide, 5000);} function prev(){if(timer)stopSlide(); if(pic == 0){ pic = 3; imgSlide.src = images[pic].src;}else{pic--;imgSlide.src = images[pic].src;}} function next(){if(timer)stopSlide(); if(pic == 3){ pic = 0;imgSlide.src = images[pic].src;}else{pic++;imgSlide.src = images[pic].src;} } function stopSlide(){clearTimeout(timer);} </script></head> <body><div id="imageContainer"><img id="img" src="waterfall-0.jpg" alt="image" title="image"/></div><a href="JavaScript:slide()" title="Start">Start</a><a href="JavaScript:next()" title="Next">Next</a><a href="JavaScript:prev()" title="Previous">Previous</a><a href="JavaScript:stopSlide()" title="Stop">Stop</a> </body></html> To try it out, just replace the images with your own images. You can use <input type="button" /> or <button type="button"></button> for the controls, but in this case I just used links.
  17. Thanks Birbal and Boen for your input.So to clarify: When we see something like this:<bookstore> <book> <--- this space right here is considered a childNode of book; so var y = book[0].childNodes[0]; would target this space. To get to title, we have to do this: var y = book[0].childNodes[1]; <title>Learn XML</title> <author>John Doe</author> </book></bookstore>Everything in between element tags ie: <title></title> is considered a chiildNode of this tag, even if it's just plain text?So <title>Learm XML</title>, first child (childNodes[0] in this case) of title is 'Learn XML'. To get that value we would do: childNodes[0].nodeValue; For some reason prior to all this, I was under the impression this was considered the 'nodeValue' because it is plain text and that childNodes[] is only used to get another element within that element, this case being title. So in other words, I was under the impression that to get 'Learn XML', we would just do this: var y = book[0].childNodes[1].nodeValue; but instead it's actually this: var y = book[0].childNodes[1].childNodes[0].nodeValue;
  18. I don't think that matters when it comes to accessing xml files or text files in general. I think what you mentioned is really only for server requests, but I could be wrong. Here's an example from w3schools website:This is the HTML page: <!doctype html><html><head><script type="text/javascript" src="loadxmldoc.js"></script></head><body> <script type="text/javascript"> xmlDoc=loadXMLDoc("books.xml"); x=xmlDoc.getElementsByTagName("title")[0]y=x.childNodes[0];document.write(y.nodeValue); </script></body></html> This is what the loadxmldoc.js looks like: function loadXMLDoc(dname){if (window.XMLHttpRequest) { xhttp=new XMLHttpRequest(); }else { xhttp=new ActiveXObject("Microsoft.XMLHTTP"); }xhttp.open("GET",dname,false);xhttp.send();return xhttp.responseXML;} This is the xml file: <bookstore><book category="cooking"><title lang="en">Everyday Italian</title><author>Giada De Laurentiis</author><year>2005</year><price>30.00</price></book><book category="children"><title lang="en">Harry Potter</title><author>J K. Rowling</author><year>2005</year><price>29.99</price></book><book category="web"><title lang="en">XQuery Kick Start</title><author>James McGovern</author><author>Per Bothner</author><author>Kurt Cagle</author><author>James Linn</author><author>Vaidyanathan Nagarajan</author><year>2003</year><price>49.99</price></book><book category="web" cover="paperback"><title lang="en">Learning XML</title><author>Erik T. Ray</author><year>2003</year><price>39.95</price></book></bookstore>
  19. I've been taking a look at XML and have some confusion. Here's the XML file.. books1.xml: <?xml version="1.0" encoding="ISO-8859-1"?><bookstore><book> <title>XML</title> <author>John Doe</author></book></bookstore> And here's the html file: <!DOCTYPE HTML><html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><title>XML</title><script type="text/javascript">window.onload = function(){if (window.XMLHttpRequest) {// code for IE7+, Firefox, Chrome, Opera, Safari xmlhttp = new XMLHttpRequest(); }else {// code for IE6, IE5 xmlhttp = new ActiveXObject("Microsoft.XMLHTTP"); } xmlhttp.open("GET","books1.xml",false);xmlhttp.send();xmlDoc = xmlhttp.responseXML; book = xmlDoc.getElementsByTagName("book");var y = book[0].childNodes[0];console.log(y.nodeValue);}</script> </head> <body></body></html> According to what I gathered, console.log should display 'XML' but nothing displays for me, not even errors. book[0] is suppose to get the first book and there's only one anyway. So then book[0] would give me access to the first book listing. Then, isn't y = book[0].childNodes[0]; give me access to first 'title' element? Also, isn't console.log then suppose to display the value for the title element, which is XML? Thanks, any input is really appreciated it.
  20. Are you getting any errors? If so, you can post them as well.Also, are you sure you renamed it correctly? If clicked on the file and right clicked and clicked on rename, that doesn't rename the WHOLE file. Make sure the whole file is index.php and not index.php.html. If you're under windows and you went directly to the file and right clicked on it and clicked on rename, and typed index.php, it will be saved as index.php.html still.
  21. index.html is now index.php ?If so, repost that page to see what you have so far.
  22. The form is being submitted to a page called insert.php. That may explain why nothing is being added to the database table. Also, if you're going to have php in HTML/PHP webpage, you have to change the extension to .php: index.php
  23. What is the above page called? I'm assuming that's your homepage, so something like index.html?
  24. Don E

    Menu(php)

    You mean something like this: Ex: $menu = array("Home" => "index.php", "Services" => "services.php", "About" => "about.php", "Contact" => "contact.php"); That's an associative array. To get index.php: $menu['Home'];
  25. If you're going to use dreamweaver, I highly suggest only in 'code view'. It would be nice if they made a 'lite' version of dreamweaver that's only 'code view' oriented. I'll behonest though, from the many IDE's I've had, dreamweaver is probably one of the most stable. Not saying the others aren't, I was just stating. Notepad++ is a little buggy for me for some reason. I try to change the font size and sometimes it doesn't change, but when changed and saving the settings, close it, then reopen it, the settings are back to default. I update it and still get the same results.
×
×
  • Create New...