Jump to content

MinusMyThoughts

Members
  • Posts

    227
  • Joined

  • Last visited

Everything posted by MinusMyThoughts

  1. can someone please let me know what the function is to check the height and width of an image? i couldn't find it in the tutorial......thanks!love,jason
  2. how does that work? i figure if i understand the command, i won't need to ask again......also, i'm generating my img tag with php, so can i get the same effect using this? $pic1 = '<img src="images/userPics/pic1.gif?anything=' . rand(1,1000) . '" align="left">'; love,jason
  3. I'm running into an issue with my image replacement feature. I can successfully upload, rename, and save an image to replace the old image, but when i view the updated page, i still see the cached image until i reload. i looked for cache clearing scripts through this forum, but the one i found didn't seem to work in IE or Firefox......is it possible to force a browser to reload? or should i try a different approach and rename my new images to something different and use a database to store the new image name?...obviously, my life will be easier if i can just force a reload. any ideas?love,jason
  4. while($i < count($para) && $i >= 2){echo stripslashes($para[$i]);$i++;} is that how you add a second parameter to the loop? or, i guess if i was still using $i, the value would already be 2 because of my previous while(), right? thank you for the help!
  5. crap. i changed that on my test file and forgot to change it in the post......sorry!love,jason
  6. This book was recommended to me when i asked the same question.love,jason
  7. <?php if ($row_RSsales['website'] == '') { echo '<a href="' . $row_RSsales['website'] . '" target="_blank">' . $row_RSsales['name'] . '</a>'; } else { echo $row_RSsales['name']; }?> that should do it.love,jason
  8. it works in IE and in Firefox. i haven't tested anything else......the reason i ended up using the first AND second paragraphs is that i could only get the explode function to work when i passed "\n" as my parameter. "\n\n", "<br/>", "<br />", and any other combination i tried just returned the whole section of text as Array[0]......so what happens when i explode the text is i get $para[0] containing my first paragraph and $para[1] containing a hard return. it doesn't bother me because now i don't have to insert breaks when i print the array......as far as the end of the file, i was worried that the loop would continue endlessly, but isn't the while function conditioned to loop WHILE a condition is true, meaning if my array only has 6 items, when $i = 7, the condition is no longer true, because it's not returning an item, therefore stopping the loop?...that's what i understood when i read the documentation, at least...love,jason
  9. once again, i found something to correct my problem. it might be sloppy, so if anyone feels helpful, check this code and tell me if there's a more efficient way to do this: <?php if (file_exists("images/userPics/pic1.gif")) { $pic1 = '<img src="images/userPics/pic1.gif" align="left">'; } else if (file_exists("images/userPics/pic1.jpg")) { $pic1 = '<img src="images/userPics/pic1.jpg" align="left">'; } else { $pic1 = ''; } $mysql_user = 'user'; $mysql_pass = 'pass'; $mysql_host = 'host'; $connect = mysql_connect($mysql_host,$mysql_user,$mysql_pass) or die("Could not connect. " . mysql_error()); $db_select = mysql_select_db('database', $connect) or die("Could not select database. " . mysql_error()); $query = "select * from content where contentID = 2"; $result = mysql_query($query); if($result) $row = mysql_fetch_array($result); $para = explode("\n",stripslashes(nl2br($row['contentText']))); $i = 0; while($i <= 1) { echo stripslashes($para[$i]); $i++; } echo $pic1; while($i >= 2) { echo stripslashes($para[$i]); $i++; }?> ...thanks!love,jason
  10. you have to save the file as .php...also, if your computer doesn't have PHP running on it (unless you've installed it yourself, it probably doesn't), you have to upload the saved file to a server that supports PHP and view it there......hope that helps!love,jason
  11. i want to put an image into a string pulled from a database. i figured out that i want to use explode() to separate the string out into paragraphs using either "\n\n" or "<br /><br />" as my parameter. however, i'm unsure how to echo the text after i've separated it. i'm unfamiliar with arrays, and i couldn't find anything in the tutorial that made it clear how to use my exploded string......the format that i'm looking to create is this:Paragraph 1<img>Paragraph 2All remaining paragraphs...any suggestions? thanks!love,jason
  12. sorry. i found an updated online resource and solved my own problem. nevermind!love,jason
  13. I'm using an older reference book to put together an image uploading page on my site, so the user can change the images displayed on their site. i'm not sure what i'm doing wrong, but my file type check is failing and killing the rest of my script, telling me that the file is in an unrecognized format......i'm uploading a small .jpg file to test with, so it shouldn't be causing an error......anyways, here's the code i'm using.my upload form <form enctype="multipart/form-data" action="picUpload.php" method=post target="_parent"> <input type="hidden" name="picID" value="pic1"> <input type="hidden" name="MAX_FILE_SIZE" value="1024000"> <input name="pic" type="file"> <input type="submit" value="Upload"> </form> my script to handle the upload <?php session_start(); $picID = $_POST['picID']; $pic_tmp = $_FILE['pic']['tmp_name']; $pic = $_FILE['pic']['name']; $pic_size = $_FILE['pic']['size']; $pic_type = $_FILE['pic']['type']; $pic_error = $_FILE['pic']['error']; $_SESSION['picID'] = $picID; $_SESSION['pic'] = $pic;//file upload check if ($userfile_error) { echo 'Problem: '; switch ($userfile_error) { case 1: echo 'File exceeded maximum filesize!'; break; case 2: echo 'File exceeded maximum filesize!'; break; case 3: echo 'File only partially uploaded!'; break; case 4: echo 'No file uploaded!'; break; } exit; } if ($pic_type != 'image') { echo 'Problem: The file you uploaded is not in a recognized format!'; exit; } $upfile = 'images/userPics/'.$picID; if(is_uploaded_file($userfile)) { if(!move_uploaded_file($userfile,$upfile)) { echo 'Problem: Could not move file to destination directory.'; exit; } } else { echo 'Error with the file you uploaded: '.$userfile_name; exit; }?><html>//my formatting HTML<?php echo 'File uploaded successfully!<br/><br/>'; echo '<img src="images/userPics/'.$picID.'"><br/><br/>'; echo '<a href="phat2575.php">Return to update page</a>';?></html><?php session_write_close();?> i'm not quite sure what i've done wrong, so any suggestions are greatly appreciated! thanks!love,jason
  14. well, for my purposes, i won't be using many images. so if i just place my uploaded images in the /images folder named, say, pic1 through pic9, i'll probably be alright......just a quick question, though: if i have an image loaded called pic1, and i upload another one that will be replacing pic1, will i get an error, or will i need extra code to overwrite the file?...thanks!love,jason
  15. i'm trying to allow my user to update all of the content, including the images on the site. on my current project, there are three images on the main site and a handful of 75x75 images that will go up with testimonials......the reference book i've got only tells me how to upload a text file into a folder. i think i'd be able to put the images in a folder, but i'd rather have them in a database. if you know a reason to use a folder instead, i'm all ears; i've barely learned MySQL, so i want to put everything in it now. ...also, can you upload a picture and update a database with the same form, but still maintain the ability to update one or the other without problems?...thanks for any direction you can point me in!love,jason
  16. amazing, as always! except i ended up using:str_replace("<br />","",$code);when it was replacing it with "\n" i was causing something that should have looked like this:Test text.More test text.to look like this:Test text.More test text.so by replacing <br /> with nothing, i was able to keep the same formatting without having the potentially confusing HTML in the text......thanks again!love,jason
  17. hi again!...i've got a dynamically loading page now that displays the contents of my selected database entry for editing and so on. if this website were a game, i'd be winning. ...i've got a problem, though, with the way my textarea is reading the database. when i put my variable into the textarea, it's placing a <br/> after every line break......so, what i'm asking is this: can you take out HTML from a textarea and preserve the line breaks?...thanks!love,jason
  18. i don't know what i was doing wrong before......i shut down and moved to another location, opened up my laptop and changed the URLs back to the relative addresses. everything works fine, now......now i want to know what i was doing wrong......oh well, i guess. it works!...thanks you guys!love,jason
  19. i don't know what's going on, then......because i get a 404 error when i use that. but it shows up when i use an absolute. has anyone ever heard of this before?love,jason
  20. alright, i can get the iframe to work, but i have to use the full path to get it to show......any tips on using relative paths?...thanks!love,jason
  21. awesome! thanks so much!...i'll be sure to let you know how it works out for me!love,jason
  22. awesome! thanks so much!...i'll be sure to let you know how it works out for me!love,jason
  23. shiftJIS-i'm interested, for sure! i don't have any idea how to do that, however. where's a good place to start learning iframes?love,jason
  24. i can't seem to get that to work. it kills the javascript, somehow. i tried to escape the session call ($_SESSION[\'homeBody\']), but that gave me an error. i tried moving the <?php ?> tags around to fix it, but it seems like so long as there is a php tag in the code, the javascript won't work......any suggestions?...thanks!love,jason
  25. I created a dropdown box (with the help of people on this forum, of course), and i think i've come to a point that i need a better method......right now i'm using a conditional javascript based on the selection in a dropdown box. it works great for what it is, but i want to automatically populate my text fields with the information from the page the user is trying to update......here's what it looks like now. brace yourself: <script type="text/javascript"><!--function change_pages(val){if(val == "Home"){document.getElementById('updater').innerHTML = "<form action=\"preview.php\" method=post><table border=\"0\" class=\"w495\"><tr><td align=\"right\" width=\"200\"><p><b>Body:</b></p></td><td align=\"center\" class=\"w360\"><textarea rows=\"8\" cols=\"20\" name=\"homeBody\" class=\"w360\"></textarea></td></tr><tr><td align=\"right\" colspan=\"2\"><input type=\"hidden\" name=\"contentID\" value=\"1\"><input type=\"submit\" value=\"Update Home\"></tr></table></form>";} else if (val == "About"){document.getElementById('updater').innerHTML = "<form action=\"update.php\" method=post><table border=\"0\" class=\"w495\"><tr><td align=\"right\" width=\"200\"><p><b>Body:</b></td><td align=\"center\" class=\"w360\"><textarea rows=\"8\" cols=\"20\" name=\"aboutBody\" class=\"w360\"></textarea></td></tr><tr><td colspan=\"2\" align=\"right\"><input type=\"submit\" value=\"Update About\"></tr></table></form>";} else if (val == "Services"){document.getElementById('updater').innerHTML = "<form action=\"update.php\" method=post><table border=0 class=\"w495\"><tr><td align=\"right\" width=200><p><b>Picture 1 URL:</b></td><td align=\"center\" class=\"w360\"><input type=\"text\" class=\"w360\" name=\"servicesPic1\" value=\"http://\"></td></tr><tr><td align=\"right\" width=200><p><b>Picture 2 URL:</b></td><td align=\"center\" class=\"w360\"><input type=\"text\" class=\"w360\" name=\"servicesPic2\" value=\"http://\"></td></tr><tr><td align=\"right\" width=200><p><b>Body:</b></td><td align=\"center\" class=\"w360\"><textarea rows=\"8\" cols=\"20\" class=\"w360\" name=\"servicesBody\"></textarea></td></tr><tr><td align=\"right\" colspan=2><input type=\"submit\" value=\"Update Services\"></td></tr></table></form>";} else if (val == "Media Credits"){document.getElementById('updater').innerHTML = "<form action=\"update.php\" method=post><table border=0 class=\"w495\"><tr><td align=\"right\" width=200><p><b>Article Title:</b></td><td align=\"center\" class=\"w360\"><input type=\"text\" class=\"w360\" name=\"mediaTitle\"></td></tr><tr><td align=\"right\" width=200><p><b>Publication:</b></td><td align=\"center\" class=\"w360\"><input type=\"text\" class=\"w360\" name=\"mediaPublication\"></td></tr><tr><td align=\"right\" width=200><p><b>Cover URL:</b></td><td align=\"center\" class=\"w360\"><input type=\"text\" class=\"w360\" name=\"mediaCover\" value=\"http://\"></td></tr><tr><td align=\"right\" width=200><p><b>Article URL:</b></td><td align=\"center\" class=\"w360\"><input type=\"text\" class=\"w360\" name=\"mediaArticle\" value=\"http://\"></td></tr><tr><td align=\"right\" width=\"200\"><p><b>Article Excerpt:</b></td><td align=\"center\" class=\"w360\"><textarea rows=\"8\" cols=\"20\" class=\"w360\" name=\"mediaBody\"></textarea></td></tr><tr><td align=\"right\" colspan=2><input type=\"submit\" value=\"Update Media Credits\"></td></tr></table></form>";} else if (val == "Testimonials"){document.getElementById('updater').innerHTML = "<form action=\"update.php\" method=post><table border=0 class=\"w495\"><tr><td align=\"right\" width=200><p><b>Name:</b></td><td align=\"center\" class=\"w360\"><input type=\"text\" class=\"w360\" name=\"testName\"></td></tr><tr><td align=\"right\" width=200><p><b>Position:</b></td><td align=\"center\" class=\"w360\"><input type=\"text\" class=\"w360\" name=\"testPosition\"></td></tr><tr><td align=\"right\" width=200><b>Picture URL:</b></td><td align=\"center\" class=\"w360\"><input type=\"text\" class=\"w360\" name=\"testPicture\" value=\"http://\"></td></tr><tr><td align=\"right\" width=\"200\"><p><b>Testimonial:</b></td><td align=\"center\" class=\"w360\"><textarea rows=\"8\" cols=\"20\" class=\"w360\" name=\"testBody\"></textarea></td></tr><tr><td colspan=\"2\" align=\"right\"><input type=\"submit\" value=\"Update Testimonials\"></tr></table></form>";} else if (val == "Links"){document.getElementById('updater').innerHTML = "<form action=\"update.php\" method=post><table border=0 class=\"w495\"><tr><td align=\"right\" width=200><p><b>Link Name:</b></td><td align=\"center\" class=\"w360\"><input type=\"text\" class=\"w360\" name=\"linkName\"></td></tr><tr><td align=\"right\" width=200><p><b>Link URL:</b></td><td align=\"center\" class=\"w360\"><input type=\"text\" class=\"w360\" name=\"linkUrl\" value=\"http://\"></td></tr><tr><td align=\"right\" width=200><p><b>Banner URL:</b></td><td align=\"center\" class=\"w360\"><input type=\"text\" class=\"w360\" name=\"linkBanner\" value=\"http://\"></td></tr><tr><td align=\"right\" colspan=2><input type=\"submit\" value=\"Update Links\"></table></form>";} else if (val == "Newsletter"){document.getElementById('updater').innerHTML = "<form action=\"lettersender.php\" method=post><table border=\"0\" class=\"w495\"><tr><td align=\"right\" width=200><p><b>Subject:</b></td><td align=\"center\" class=\"w360\"><input type=\"text\" class=\"w360\" name=\"subject\"></td></tr><tr><td align=\"right\" width=\"200\"><p><b>Body:</b></td><td align=\"center\" class=\"w360\"><textarea rows=\"8\" cols=\"20\" name=\"body\" class=\"w360\"></textarea></td></tr><tr><td colspan=\"2\" align=\"right\"><input type=\"submit\" value=\"Send Newsletter\"></tr></table></form>";} else {document.getElementById('updater').innerHTML = "<b>Please select which page you would like to edit</b>";}}//--></script> ...the dropdown box is sitting inside a <div> labeled "updater" that changes based on the selection in the box......now, messy as i've made this, it does the trick (or it did, at least). my form actions are strange because i'm trying to only develop "Home" for now, until i've got that running smoothly, then integrate into the rest of the site......my goal is to give the textarea in "Home" a value of $_SESSION['homeBody']. i realize now that it's going to be either impossible or impossible to read......so, i guess, my primary goal is to find a way to get the same kind of dropdown box without needing all the mess. is that possible?...can someone kick me in the right direction?...thanks again!love,jason
×
×
  • Create New...