Jump to content

john_jack

Members
  • Posts

    77
  • Joined

  • Last visited

Everything posted by john_jack

  1. i used your script + some miner changes ,i used the json from http://www.w3schools.com/appml/customers.php .made some change to listJson function . using IE 8 i replaced document.getElementById("demo").innerHTML = text; by $('#demo').html(text); and it works . heres the script : <!DOCTYPE html> <html lang="en"> <head> <meta name="dcterms.created" content="Di, 29 Dez 2015 22:56:32 GMT"> <meta name="description" content="GeoMon Template Page"> <meta name="keywords" content="Just a template"> <meta content="text/html; charset=utf-8" http-equiv="content-type" /> <meta name="viewport" content="width=device-width, initial-scale=1"> <link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css"> <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script> <script src="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"></script> <title>Json Viewer</title> </head> <body> <p>The best way to loop through an array is using a standard for loop:</p> <button onClick="readFromServer('http://www.w3schools.com/appml/customers.php')">Try it</button> <p id="demo"></p> <script> function listJson( content ) { var index, text = "<ul>"; for (index = 0; index < content.records.length; index++) text += "<li>" + content.records[index].CustomerName + " " + content.records[index].City + "</li>"; text += "</ul>"; $('#demo').html(text); //document.getElementById("demo").innerHTML = text; } function readFromServer(url) { var xmlhttp = new XMLHttpRequest(); xmlhttp.onreadystatechange = function() { if (xmlhttp.readyState == 4 && xmlhttp.status == 200) { document.getElementById("demo").innerHTML = ""; setTimeout(function(){ listJson(JSON.parse(xmlhttp.responseText)); }, 3000); } }; xmlhttp.open("GET", url, true); xmlhttp.send(); } </script> </body> </html>
  2. var userdata = "firstname="+fn+"&lastname="+ln+"$email="+e+"&phone="+p+"&message="+m; the name you need to use on php side is $_post["firstname"] instead of $_post["first"].
  3. if the image is still not showing up but other info like the adress and such is showing , maybe the problem is in the image path in your database . -check if the car directory exists -make sure that the images you are trying to display are in car directory -check the images paths in your database . PS open the developer tools on your browser and check the path in the <img> tag
  4. try to prevent default submit : use event.preventDefault(); before the tinyMCE.get('mytextarea').focus() . works for me
  5. First of all take a look here http://www.w3schools.com/jquery/jquery_selectors.asp i tried this and it works . <html> <head> <style> .nav{ display: block; width: 10%; float: left; margin-left: 6.25%; margin-top:-10px; opacity: 0; } .vis{ opacity: 1; } </style> <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script> </head> <div style="width:100%"> <img src="skit/images/example/002.jpg" class="nav" id="img1"/> <br /> </div> <div id="of"></div> <script> jQuery(document).ready(function () { var navOffset = jQuery("#of").offset().top; jQuery(window).scroll(function () { var scrollPos = jQuery(window).scrollTop(); //alert(scrollPos); $("#of").html("nav :" + navOffset +"scroll :"+scrollPos); if (scrollPos >= navOffset) { jQuery("#img1").addClass("vis"); jQuery("#img1").removeClass("nav"); } else { jQuery("#img1").removeClass("vis"); jQuery("#img1").addClass("nav"); } }); }); </script> okok</br>okok</br>okok</br>okok</br>okok</br>okok</br>okok</br>okok</br>okok</br>okok</br>okok</br>okok</br>okok</br>okok</br>okok</br>okok</br>okok</br>okok</br>okok</br>okok</br>okok</br>okok</br>okok</br>okok</br>okok</br>okok</br>okok</br>okok</br>okok</br>okok</br>okok</br>okok</br>okok</br>okok</br>okok</br>okok</br>okok</br>okok</br>okok</br>okok</br>okok</br>okok</br>okok</br>okok</br>okok</br>okok</br>okok</br>okok</br>okok</br>okok</br>okok</br>okok</br>okok</br>okok</br>okok</br>okok</br>okok</br>okok</br>okok
  6. here is an eg : <img src="./01.png" id='img1'/> <img src="./02.png" id='img2'/> <script> var x=1; var myVar = setInterval(myTimer, 1000); function myTimer() { if(x%2==0){ document.getElementById("img1").style.display = "none"; document.getElementById("img2").style.display = "block"; x=1; } else{ document.getElementById("img2").style.display = "none"; document.getElementById("img1").style.display = "block"; x=2; } } </script> all you have to do is get some images and set the SRC path to the right location .
  7. create your editor as web application using a browser (you can use html for the UI and can execute JS).
  8. i suppose you are typing html in the the text fileds : $title=$_POST['title']; $body=$_POST['body']; use this instead to avoid errors even thoe you didnt mention an error ! $title=addslashes($_POST['title']); $body=addslashes($_POST['body']); as for the large size post problem try one of these 2 solutions 1) go to php.ini post_max_size=20M upload_max_filesize=20M 2) use an .htaccess / httpd.conf / virtualhost include php_value post_max_size 20M php_value upload_max_filesize 20M
  9. you need to put the " Echo" part inside the while loop . replace it with this : <?php $con=new mysqli("localhost","root","", "testdb"); $sql="SELECT * FROM cms"; $run=mysqli_query($con, $sql); while($row=mysqli_fetch_array($run)) { $title=$row['title']; $body=$row['body']; echo " <h1> $title</h1 <p>$body</p> "; } ?>
  10. here is a simple code to help you understand . Unit price :<input type="text" id="unit_price" /><br /> Quantity :<input type="text" id="quantity" /><br /> <button id="b_total" onclick="calculate();">calculate</button><div id="result"></div> <script> function calculate() { var price_unit=document.getElementById("unit_price").value; var quantity=document.getElementById("quantity").value; document.getElementById("result").innerHTML = quantity * price_unit +" $"; } </script> all you need is set your own values (if you are retriving data via Php from a database or whatever) + calculate the tax and you ae good to go
  11. take a look at this http://www.w3schools.com/js/js_switch.asp
  12. for the signup : usualy theres a basic html form that sends the data to a server side script Php for eg.the php file checks the validity of the data sent via the form if everything is ok you insert the data in a database for eg "a table called user" via SQL query . check this http://www.w3schools.com/Php/php_forms.asp for the sign in : a basic html for login and password once submited transmits the data to a php file that checks if the user is registred in the database if its ok you redirect him to a page of your choice . you will have to use sessions http://www.w3schools.com/php/php_sessions.asp to keep track of the user and what he can access or not
  13. yes Correct ,usualy theres only 1 variable on the left of "=" .unless theres more '=' signs like $a=$a+$b=$c+$d;
  14. not sure what you are saying but "=" and i tried this code : <?php $a=1; $b=2; $c=3; $d=4; $a+$b=$c+$d; echo"a = $a b= $b c= $c d= $d"; ?> the result was a = 1 b= 7 c= 3 d= 4 . as you can see the $a stayed the same no value assigned to it after the $a+$b=$c+$d; only $b gets a new value . hope this explains it
  15. the equal sign "=" doesnt stand for egality it means affectation ,meaning what is on the right side of the = sign endup on the left . so $y = $x + $y means calculate the value of X+Y and store it in Y .
  16. Oh man i ,i was about to tell you still didnt work!! and you posted the thing about the encoding and that was it man ; UTF8 ftw thanks a lot for your help it works like a charme now .
  17. check this http://www.w3schools.com/sql/sql_join.asp
  18. i folowed the tutorial as it was at first but didnt work ,didnt create the database .so i though maybe if i created it it will resolve the issue but sadly no . i used the sql provided in create_customer.js to create the table . when i use a php file to retrive data and make the result as json it works . i know these kinda tutorials are usualy to be 100% working ,but idk man ! thats why i asked if theres a way to get more details about the error somehow :s anything else i can provide you that might help?
  19. if wha you want is clean string no \ then use this : $url="\sd\s\qq\\\\\\"; echo $url."<br>"; do{ $cleanurl=$url; $url=stripslashes($url); }while($cleanurl!=$url); echo $url."<br>";
  20. john_jack

    Hide information

    if you could post the code you have 'if you have one ',we might be able to help .otherwise you need to learn some php/sql basics
  21. you can think of sessions as a global variable declared on the server side ,you can get access to session variable from any php file where session_start is mentioned
  22. you should change : this "echo "<img src="car/.$images." height="100" title="$title" alt="car" />";//this is going wrong" to echo "<img src='car/".$images." ' height='100' title=' ".$title." ' alt='car' />"; Good luck
  23. i created it teh databse directly from mysql coz the create_customers not working . the point is my database is created and populated .yet not retriving data. thanks
  24. have you tried using opendir and readdir http://php.net/manual/en/function.opendir.php .i used it a while ago it works like a charm.
  25. how bout http://php.net/manual/en/function.addslashes.php and http://php.net/manual/en/function.stripslashes.php they might do it for you!
×
×
  • Create New...