Jump to content

pb1uk

Member
  • Posts

    71
  • Joined

  • Last visited

pb1uk's Achievements

Newbie

Newbie (1/14)

0

Reputation

  1. pb1uk

    PHP form problem

    Hi all, I'm having a complete mind blank, sure there is a very simple answer to my soloution, but i just can't find it! Basically i have a registration form. When submitting the form goes to another page to process the information. It successful the info will be entered into the database and the user is redirected to the login page. If there is a problem with the data supplied, e.g. the username chosen has already been taken the page will redirect back to the registration form. What i'm trying to do it make it so the form is automatically filled in with what the user previously entered if that makes sense. If anyone knows how to do this i would be very greatful! Thanks, pb1uk
  2. I have experienced problems between IE and Firefox before, but not with a favicon. Can you paste the bit of code that you added that's causing a problem?
  3. Do you specifically have to do it in that way? What i would do is have it database driven and allow users to upload files to a table in the database, that would hold user id, file name and file type. You can set it up the file name so it's saved with a prefix of the users name/id. So when a user uploads a file it is saved to folder on the server and the information about the file is held in the db. Then you can query the db so a user can access their files. This way you don't have to setup a folder for each user and everything is kept seperate by saving the users id/username in the files table
  4. If i were you i wouldn't use images to create rounded corners for your div. Have a read up about css3. Most browsers support it now. I know firefox and chrome do, am pretty sure Safari does and IE 9 supports some css3, am sure it does border radius. To get you started my mate has created a site that will generate code for you, and trust me it's a lot easier to understand than using images! The link is here There is also ways you can set your css so that if the browsers doesn't support css3 then use images, but i'd not bother messing around with that and just use css3. In my view so what if some people using an old version of IE see square corners?!?! Serves that right for using a rubbish browser
  5. From having a brief play with google unless you actually type facebook into search bo facebook pages do not appear in the search results (high up anyway). True facebook is great for letting people know about a company name and spreading the word, but at the end of the day it is very restricted in what you can actually do. It doesn't cost much or indeed take much time to create a basic site with a few pages of content. Then you can direct people from the facebook page(S) to the actual site and visa versa if you wish. There's also a lot you can do to integrate a companies site with facebook. Most basically adding like and share button to pages like news items or products. This again is another way of getting people from facebook to an actual site. If just one person likes something, there's a link to your site on their news feed it's a no lose situation! If you plan on making a site for the company that involves a user login then you can use facebooks login means you don't have to do it yourself, you just have to integrate with their system, easy! At the end of the day as you say just having a facebook page does look a bit cheap and any business that wants to grow should have their own website, it makes sense!
  6. Very basically to get you started you could use the following: <script type="text/javascript"> function addToCart(){ document.getElementById("link1").style.display='none'; document.getElementById("link2").style.display='block'; } function removeFromCart(){ document.getElementById("link1").style.display='block'; document.getElementById("link2").style.display='none'; } </script> <a href="./addToCart.php?id=1" onclick="addToCart(); return false;" id="link1">Add to Cart</a> <a href="./removeFromCart.php?id=1" onclick="removeFromCart(); return false;" id="link2" style="display:none;">Remove from Cart</a> Just change the href to include your php and take out the return false, i just had that there for testing purposes. On the remove link when the page loads is set to display none. All the functions do is to one link to display and the other to hide. You can use the same script for the image to change, just wrap the same anchor tags around your image and styling on the image to have no border. For the image to change just had another rule to the javascript function to hide/show the relevant images
  7. A - change the anchor tag to "remove from cart" ; and B - change img emptychk.jpg to a different image (greenchk.jpg) C - Ideally, I would like clicking on the empty checkbox <img> (at the start of any row) to do the same thing as clicking <a href>add to cart </a> for that row. Is that possible? How could that be done? I'd probably do it by adding onclick to the add to cart link. This would then call a function that would change the link to remove from cart and could also change the image from emptychk.jpg to greenchck.jpg. Do this by putting the images into div or span tags and giving them an id, this way you can easily reference them in your javascript. To make the img at the start of the row do the same simple wrap anchor tags round the image the same the link. i.e. <a href="" onclick="somefunction()"><img src="path/to/image"></a>
  8. Hello all, Am continuing work on a little personal project i've had going and have encountered a few problems. Basically i'm trying to integrate google maps into my site. I've been using the this class currently as it's the best i've found for the purpose so far. Reading on the google maps documentation the way they recommend is to write the point to an xml file and then read them and send them through the api to create the map, however this won't work for me as i'm trying to use it a bit differently Very basically here's what i'm trying to do: On my site users can register. Registered users can then enter records of places they have been. I want users to then be able to view a map of where they have been and where they haven't been if that makes sense! So i'm looking for some kind of php javascript or jquery or some combination script that would be best to do this. The class above is the best i've found so far but does have its limitations. I was wondering if anyone has had any experience integrating with google this way and or if a better solution is available. Thanks for any advice in advance, pb1uk
  9. Thanks hahaha. I did try he avg function Ben (thanks for the pointer though) but couldn't get it to work. I also tried sum to add up all the numbers as well and that didn't work. Was probably my object oriented syntax that messed it up. Unfortunately Andy that tends to happen to me a lot, i start thinking about how to code up a problem and end up over thinking and overcomplicating it, hopefully over time this will improve!
  10. I've never used eclipse before. At work though i use PhpED, it can do the things you are looking for, for example you can setup a workspace and project and when you click on the function/method names if takes you there. Also when you're looking for a function to use it provides a list of the ones in your classes, i've found it very useful.
  11. I have managed to find out how to do it. Although when i had done it what i needed to do was different, but this is a start! Cheers for the point in the right directions though Andy. I have changed the code was the call states the row of the db to look in $test_rating = new Ground(); $row = "test_rating_1"; echo $test_rating->getRating($row); Then in my ground class public function getRating($row) { $total=0; //intialise total variable // select all rows except those with zero $sql = "SELECT $row FROM ground WHERE $row != 0"; $this->executeQuery($sql); // run query $count = $this->getRowCount(); // get number of rows if($count==0){ // if now rows returned return the following message return "No one has rated this yet"; } else{ while ($this->moveNext()) { // get the total rating $value = $this->$row; $total = $total + $value; } // work out average return $total/$count . " from " . $count . " ratings"; } } Hope this helps. (moveNext, executeQuery and getRowCount are all functions from my database class, would have to be replaced with yours or mysql functions for this code to work)
  12. Hi all, I know how to do this in normal php, but putting into oo php (which i'm new to) is proving to be difficult and i'm struggling to get my head around it. Basically i have a table called ground which very simply looks like this: id name rating 1 test1 5 2 test2 2 3 test3 4 etc etc. What i want to do is to work out the average of the rating column. At the moment on the page i have <?php $rating = new Ground(); $rating = $this->getRating(); ?> then in my ground class public function getRating() { $sql = "SELECT SUM(rating) AS average FROM ground"; $this->executeQuery($sql); $this->getRowCount(); // returns number of rows // here i need to work out the average! } I've tried a number of things in the class to try and work out the average, but for some reason i can't get the sum value. I admit the code above maybe and probably is riddled with errors, go easy on me am still new to the OO world! Any help would be greatly appreciated, Thanks, pb1uk
  13. Just have a read up about absoloute positioning on w3, it's quite simple. will be something like this: <style> #slide_container{position:absolute; width:??px; height:??px; top:??px; left:??px; background:url('path/to/first/pic.jpg')no-repeat;} </style> <div id="slide_container"> <!--Slideshow code in here--> </div>
  14. Excellent design, i really like it. I would know where to start with something like that! My only comment would be the links at the top of the sliding box (the one with your portfolio in for example) in the white are quick tricky to find. That's a very minor point though.
  15. What i would do is place the slideshow in a div and absolute position this where you want it on the page. Set the background image of the div to the still pic you have there already. This way if the slideshow doesn't load or someone doesn't have javascript an image will still be displayed there. Hope this works for you. Site looks very good btw
×
×
  • Create New...