Jump to content

murfitUK

Members
  • Posts

    207
  • Joined

  • Last visited

Everything posted by murfitUK

  1. Thanks everyone - using the str_replace works the best.I also found out that the character I wanted is called "middle dot" and has the code & m i d d o t or & # 1 8 3 ;. (Sorry - had to put spaces in between the characters as previewed and found that the codes had been replaced with the little dot!)The function str_replace(" ", & # 1 8 3; , $codeSnippet) with no quote marks around the & # 1 8 3 ;gives exactly what I need.This·is·what·it·looks·like·with·a·little·middle·dot.HOWEVER...... (life is never easy)Now that there are no spaces it treats it as a big long line of text with no natural breaks for it to start on a new line. This results in a horizontal scrollbar, with just one line of text at the top of the box.I think I will have to count the characters and stick a <br /> after every 40 or so, although not sure if it will work in a textarea. Will soon find out.
  2. Take out the dots before $filenameAdd a " after $filename in the move_uploaded_file lineAmend the quotemarks (I prefer to use double quotes in echo/print lines)The four important lines should now be:$filetmp = $_FILES['userfile']['tmp_name'];$filename = $_FILES['userfile']['name'];move_uploaded_file($filetmp, "images/$filename");echo "Your file is located at <a href='images/$filename'>images/$filename</a>";Now, can someone let me know how to add a line to upload.php so it will only work on .jpg, .JPG, .bmp and .BMP files. Thanks.
  3. As usual, my question is a bit vague but I'll try and explain as best I can! Wonder if this would better go in the php forum?I am using a textarea in a form which I want to populate with info from a database. This all works fine:print "<textarea name='display' cols='40' rows='6'>" . $codeSnippet . "</textarea>";The codeSnippet will have things like "This is <b>bold</b> text" which I want displayed exactly like that. I don't have to worry about stripping slashes and cleaning the data because the database is read only.The problem is that sometimes it is not clear that there is a space if it is at the end of the line. This is particularly the case with tags like <br /> where there is a space between the <br and the />. What I would like to do is display the tiny little dot in place of the spaces - you know in Word you can switch on the non-printing characters and it shows the spaces, new lines, carriage returns etc (although I'm only interested in the spaces).Is there a (quick and easy) way to do this?
  4. Thank you - the array method sounds the best way of doing it.(Sorry for the duplicate thread, I got an error message when first posting so didn't think it had worked.)
  5. Thank you - the array method sounds the best way of doing it.(Sorry for the duplicate thread, I got an error message when first posting so didn't think it had worked.)
  6. Well, I've tried it and it seems to work! There might be an easier way of doing it but this way works for me - and I thought of it all by myself.(Sorry for the two postings... when I first posted I got a sql database error message so I went back and hit submit again.)
  7. OK. I'll try my best to describe what I'm trying to do.I have a webpage through which a user can send an email. They type in their name, email address, a subject and the message then click Send. The page then calls itself, checks that none of the four fields are empty and that the email address is a valid address. If everything is OK, the email gets sent.If anything is missing the page is displayed again along with everything the user typed so that they don't have to type it all again. (You can see what it's like at www.wooden-heart.co.uk - in the Contact Us section.)Anyway, what I'd like to do is limit the subject field to a few items from a drop-down list. This works but if the page is recalled, it does not keep the subject chosen by the user - it always displays the top item. I would like it to keep what the user has already chosen, but don't know how.Here's some of the code.BEFORE (when user types subject):echo "<input type='text' name='subject' value=\"" . $_POST['subject'] . "\" />\n";The . $_POST['subject'] . bit makes sure that the user's typed field gets added to the value of subject field so the user doesn't need to type it again if the page is recalled.AFTER (when user has to choose from drop-down list):echo "<select name='subject'>\n<option value='Sales Enquiry'>Sales Enquiry</option>\n<option value='Comment About Website'>Comment About Website</option>\n<option value='Other Enquiry'>Other Enquiry</option>\n (& there will be a few more options)</select>\n";I know I can use selected='selected' to make one of the options be selected but I'm not sure what I have to do. I think I will have to put an if... in each of the option value lines. Something like:echo "<option value='Sales Enquiry' "; if ($_POST['subject']=="Sales Enquiry") echo "selected='selected'"; print ">Sales Enquiry</option>";for each line obviously changing Sales Enquiry to the relevant text.Am I on the right track? Is there an easier way to do it?Thanks.
  8. OK. I'll try my best to describe what I'm trying to do.I have a webpage through which a user can send an email. They type in their name, email address, a subject and the message then click Send. The page then calls itself, checks that none of the four fields are empty and that the email address is a valid address. If everything is OK, the email gets sent.If anything is missing the page is displayed again along with everything the user typed so that they don't have to type it all again. (You can see what it's like at www.wooden-heart.co.uk - in the Contact Us section.)Anyway, what I'd like to do is limit the subject field to a few items from a drop-down list. This works but if the page is recalled, it does not keep the subject chosen by the user - it always displays the top item. I would like it to keep what the user has already chosen, but don't know how.Here's some of the code.BEFORE (when user types subject):echo "<input type='text' name='subject' value=\"" . $_POST['subject'] . "\" />\n";The . $_POST['subject'] . bit makes sure that the user's typed field gets added to the value of subject field so the user doesn't need to type it again if the page is recalled.AFTER (when user has to choose from drop-down list):echo "<select name='subject'>\n<option value='Sales Enquiry'>Sales Enquiry</option>\n<option value='Comment About Website'>Comment About Website</option>\n<option value='Other Enquiry'>Other Enquiry</option>\n (& there will be a few more options)</select>\n";I know I can use selected='selected' to make one of the options be selected but I'm not sure what I have to do. I think I will have to put an if... in each of the option value lines. Something like:echo "<option value='Sales Enquiry' "; if ($_POST['subject']=="Sales Enquiry") echo "selected='selected'"; print ">Sales Enquiry</option>";for each line obviously changing Sales Enquiry to the relevant text.Am I on the right track? Is there an easier way to do it?Thanks.
  9. Have a look here - about half way down.http://www.w3schools.com/html/html_links.asp
  10. Have a look at this page.http://www.hypergurl.com/bookmark.html
  11. I found just the thing - although can't think why it took me so long as I visit Dynamic Drive quite a lot.http://tools.dynamicdrive.com/gradient/
  12. murfitUK

    delete

    The sql code isDELETE FROM Product_tbl WHERE ProductID='30'You should try testing it by creating a statement like the above and see if it works before you start passing variables in URLs or forms. This might narrow down a problem.Not sure how what you're using but if its php just create a query like $query="DELETE FROM...." and run it to see what happens. If it works then try building your query using a URL or form - then if it doesn't work you know where the problem is.Be careful not to delete to 30th record as it may not be sorted in order of ProductID, and the first record is always counted as 0 so the 30th record would be number 29.
  13. Hi folks.I have been working on a site. Initially it was to practice my html and css, php and mysql skills - but it has grown and grown in a haphazard manner. I now feel I have reached my limit on learning new stuff and need some help before the site can go live.All the basics have been done and it is fully functional although lots of things (like creating usernames and log-ins, and storing/retreiving stuff) could probably be done in a more efficient manner. Its only been tested by me logging in on my own - I have no idea if it will work if more than a couple of people log in at the same time!The concept of the site, as I mentioned, was to learn new things but I am wondering if it might actually be capable of earning income. It may be possible to place ads and links to online retailers such as Amazon who sell books and DVDs etc on the subjects that the site covers.I have bought the domain name and put the site up using my own hosting space for now but if the site looks as though it is feasible I will purchase extra hosting for it.I'm looking for someone who might be interested in helping me finish it off and make it look more professional. You must be competent (more competent than me!) with php and mysql etc.I would be willing to discuss paying you for your time - although not too much as I am paying for all this out of my own savings. However, if you think it might generate income I would be happy to formalise sharing of profits instead of an upfront payment.If you are interested please get in touch. It would help if you could give me a couple of lines about yourself eg what things you are good at, links to any sites you have created etc. Nothing too detailed. If you are seriously interested I will pass on further details.My email address is contact@murfituk.com or you can fill in the webform at my site www.murfituk.comThanks for reading through this waffle!
  14. I get a call to undefined function for the imagefilledrectangle thing. Does this mean my php is out of date? I'm on version 4.4.2. Daren't try to upgrade as it took me long enough to get this one up and working.Good luck with the EEG reportingsjr. Hope its nothing too serious.
  15. I think xhtml1.1 is (or was going to be) the next step up from xhtml1.0 but whereas 1.0 incorporated a lot of the deprecated html items it is proposed that 1.1 does not include ANY deprecated items. This means that if you use any deprecated code you would need to find another way of doing it if you wanted to use 1.1.As it stands 1.0 (Transitional and Frameset) is more functional than 1.1 and some browsers do not yet have the capacity to deal with 1.1.I think.I found this: http://www.w3.org/TR/xhtml11/changes.html#a_changes
  16. As you have been able to post a message I assume you already have an internet connection sorted out. That is a good first step!You need to know WHAT you want to download.You need to know WHERE to download it.Then you can usually click on the thing you want to download, or right-click and choose Save As.If you give us some more information about what you want to do then we can help more.
  17. This page will give you some information about what a doctype is, why its necessary, and a link to some of the valid doctypes you can use.http://www.w3.org/QA/Tips/Doctype
  18. It really doesn't matter where the data is saved in your database. The important thing is how it is sorted when you pull the information out in a query.If you have a particular reason for doing so you could let us know why and there will be someone reading these boards who can help.
  19. I've got a couple of websites that use background images when hovering over navigation links. I've only got three of them ("acquired" from other people's sites!) so the sites all look the same.Here's what I mean:Got to admit I'm not experienced with images and graphics so am asking how I might be able to produce these sorts of graphics. Note the colour gradient changes from left to right.Is there some sort of website that might allow me to customise my own images to download (for free of course). I've looked at a couple which allow creation of buttons but not graphics like this.I've got MS Paint but can't see anyway to do it and don't really want to install any fancy graphics software for such a small task.Any suggestions?Thanks.
  20. It's easier to do this using CSS - here is a webpage that will show you how to make a 3-column layout although there are lots of other ways. Try google for "css layouts.http://css.maxdesign.com.au/selectutorial/tutorial_intro.htmHave a look at the finished sample to see the final layout.
  21. If using php try this. If you put the text input into a variable $text then print it on screen using:print nl2br($text);which will print it out with the line breaks. Its a start but you will run into problems if the user starts placing single and double quote marks into the text so you will also need to take that into account.
  22. Well, I've made a start. If anyone's interested:http://www.murfituk.com/graphscore/example.php(Now - has anyone got a php function to clean spilt coffee from a keyboard?)
  23. I'd like a function please!! I'm trying to create one now but maybe someone has already done it.Someone has taken a quiz and scored eg 15 out of 20. Pass these two numbers to the function, it calculates the percentage score (eg 75%) and it draws a narrow, long box with green for the first 75% of the width and red for the last 25%.I'm thinking about a table of say 300px long and 10px tall, and then having two td's of a width specified in %age terms.I'll let you know how I get on but if anyone has already got something like this.....!
  24. Why not have a log in page and post the username and password to a page called (for example) downloadpage.php.Then the downloadpage.php would start something like:<?phpif (($_POST['username']=="myusername") && ($_POST['password']=="mypassword") {login is successful so you could have a link to the file eg print "<a href='filetobedownloaded.zip'>click here</a>"; }else {login in not successful so the page will only show eg print "You need to log in first"; }or if you want to use sessions and have a method of starting a session called for example "authorised"="yes" then you only need to stick this in the start of any page that you want to use:session_start();if (@$_SESSION['authorised'] != "yes"){header("Location: login.html");exit;} which will redirect to the login page if not already logged in.In the top example you would need a method of retrieving the username and password from a database unless your really wanted everyone to use the same username and password.
×
×
  • Create New...