Jump to content
Stef's Coding Community

narcis

Member
  • Content Count

    18
  • Joined

  • Last visited

Everything posted by narcis

  1. TKG: This two solutions are good to center vertical and horizontal but they does not solve the problem: "if the content i larger than the window, the content is cut"
  2. grabenair: Margin 0 auto only centers the divs horizontally. I was asking "center a div horizontally and vertically"
  3. Stephenius: I just update the file with your code. It does not seem to work: http://jsfiddle.net/6KaMy/2/ Am I missing something?
  4. Is it possible to center a div (not a text or an image) horizontal and vertical? I have always used the position absolute and negative margins like in the example that I provide. But it has the problem that if the content i larger than the window, the content is cut. Is there another way to center without this problem?. I have the example here to play: http://jsfiddle.net/6KaMy/1/ I attach the file too. 0.html
  5. narcis

    Security In Php

    I'm confused about the security questions in php. I have heard of urlencode, rawurlencode, htmlspecialcharts. In which cases should I use it? Is there any video that explains it? Thank you Narcís
  6. There is an easy way to have clean URL's: you put your html file in a folder and give the file the name index.html. This way you get something like: www.myDomain/myFolder . This is more clean that the usual www.myDomain/myFile.html My questions are: is this a good practice? Has this any problems with Search Engine Optimization?
  7. I have found that one of the keywords I would like to be found in the search engine has a domain that I can register. This is not a good name for the general project, and so not for all the web, but it is a good definition or explanation of a part. Is it a good idea to register something like this just to point it to a section of the web? I mean is this effective from the SEO point of view? but more important, is it a good practice?
  8. I want to keep the footer at the bottom of the page when the window is higher than the content. But I want the footer be hidden and below the content when the window is smaller than the content. I know this can be done with css but, for different reasons, I need to use absolute positioning. This is an example of the effect with css: http://matthewjamestaylor.com/blog/keeping-footers-at-the-bottom-of-the-page I have my example with absolute positioning here playing: http://jsbin.com/alebik/1/edit I attached the file too. It works only when the window loads. But it seems that the resize function does not work? $(function(){ // initial position var footerTop = $('#footer').offset().top; if(footerTop >= 420){ //400 is the hight of the content $('#footer').css({position: 'absolute',bottom:'10px'}); }else{ $('#footer').css({position: 'absolute',top:'410px'}); } // when resize $(window).resize(function() { var footerTop = $('#footer').offset().top; if(footerTop >= 420){ //400 is the hight of the content $('#footer').css({position: 'absolute',bottom:'10px'}); }else{ $('#footer').css({position: 'absolute',top:'410px'}); } }); }) 3.2.html
  9. narcis

    Accents in php forms

    If I fill the form (with the code above and without any special thing like htmlentities) it seems to work fine. For example I fill à and the user can see à. But in the database is stored an estrange character: Ã The wright html character should be à If I write à directly in the database à it does not show for the user. If I write à in the database it shows à for the user. Even when the special characters seem to work well for the user, they are stored in a strange way in the database and could give me problems later. I suppose the wright thing would be that the user could write à, in the database could be stored à and the select should show à for the user. But I don't know how to do that. I attach the example My .php is utf8. The database collation is the default latin1_swedish_ci I tried to change the field titol_post to utf8_general_ci and it makes no change. Thank you Narcís 4.php
  10. narcis

    Accents in php forms

    I have a very simple php form. The users that fill the form in some countries like France use accents like à or letters like ç. How should be the code to insert and to select in these cases? // INSERT if (isset($_POST['text_post'])) { $sql="INSERT INTO blog (titol_post, text_post) VALUES ('$_POST[titol_post]','$_POST[text_post]')"; if (!mysql_query($sql,$con)) { die('Error: ' . mysql_error()); } // SELECT $result = mysql_query("SELECT * FROM blog"); while($row = mysql_fetch_array($result)) { echo $row['titol_post'] . " " . $row['text_post']; echo "<br />"; } } else { // FILL THE FORM echo " <form action='4.php' method='post'> Títol: <br/> <input type='text' name='titol_post'/><br/><br/> Text: <br/> <textarea name='text_post' rows='15' cols='80'></textarea><br/><br/> <input type='submit' /> </form> "; } I tried things like: echo htmlentities($row['titol_post']) but it doen't seem to work
  11. I'm in a Mac OS Lion (OS X 10.7.4)
  12. I'm testing these files in a remote server and I don't receive the mail
  13. Can anyone explain me how to send an e-mail from a web, with php? In Misc > functions: part2 Stefan Explains a bit the mail function. I try and it doesn't work for me. I get Email sent: 1, but I don't receive the email - I attached the file: mail1.php: $did_send = mail('info@mig-marketing.com','Subject','body of the message'); echo "Email sent: " . $did_send; - I tried something more complex. But I don't receive the email either. mail2.php: $to = "info@mig-marketing.com"; $subject = "Test mail"; $message = "Hello! This is a simple email message."; $from = "narcis@mig-marketing.com"; $headers = "From:" . $from; mail($to,$subject,$message,$headers); echo "Mail Sent."; mail1.php mail2.php
  14. narcis

    class redirect

    Ok. I understand. Thank you so much. Narcís
  15. narcis

    class redirect

    Yes, "class.php" include the <?php tag and two }. I updated my question and attached the files of my simplified exercise.
  16. narcis

    class redirect

    I'm seeing the course PHP SHOPPING CART WITH OOP, MVC & PAYPAL. In the video Template object: part 1 explains how to redirect using a class. I tried to do the same but simplifying the question to be able to understand it better. 1- I create the file "class.php": <?php class Template{ public function redirect($url) { header("location: $url"); exit; } } 2- I create the file index.php where I call the class. I put this in the head: <?php include("class.php"); $Template = new Template(); $Template->redirect('http://www.apple.com'); ?> class.php index.php when I go the the index I'm not redirected. What is missing?
×
×
  • Create New...