Jump to content

Search the Community

Showing results for tags 'javascript'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


  • Welcome to PHP Freaks
    • Announcements
    • Introductions
  • PHP Coding
    • PHP Coding Help
    • Regex Help
    • Third Party Scripts
    • FAQ/Code Snippet Repository
  • SQL / Database
    • MySQL Help
    • PostgreSQL
    • Microsoft SQL - MSSQL
    • Other RDBMS and SQL dialects
  • Client Side
    • HTML Help
    • CSS Help
    • Javascript Help
    • Other
  • Applications and Frameworks
    • Applications
    • Frameworks
    • Other Libraries
  • Web Server Administration
    • PHP Installation and Configuration
    • Linux
    • Apache HTTP Server
    • Microsoft IIS
    • Other Web Server Software
  • Other
    • Application Design
    • Other Programming Languages
    • Editor Help (PhpStorm, VS Code, etc)
    • Website Critique
    • Beta Test Your Stuff!
  • Freelance, Contracts, Employment, etc.
    • Services Offered
    • Job Offerings
  • General Discussion
    • PHPFreaks.com Website Feedback
    • Miscellaneous

Find results in...

Find results that contain...

Date Created

  • Start


Last Updated

  • Start


Filter by number of...


  • Start





Website URL








Donation Link

  1. I just found code that does this: orig = orig.replace( "<br>", "<br>" ); orig = orig.replace( "<BR>", "<br>" ); orig = orig.replace( "<bR>", "<br>" ); orig = orig.replace( "<Br>", "<br>" ); I see why it's done this way (to encompass any caps variation on the BR) but since .replace() will only get the first instance, this is just bad all the way around. Also, there's no way to do a toLowerCase() because that will mess up the rest of the string. Is there some sort of JS regex way to replace all instances of <br> regardless of the caps? Thanks!
  2. Hey guys, I am trying to add a open source map known as leaflet i am not having so much of an issue adding the map , as i am the map not showing up correctly. I have tried adding this to my webpage i am creating for a client, but through the layout i have, i was not able to correctly match the style. I then went to a demo page to see if i can simply load the map by itself. i added the .js file , css , and rel link in the html. like i said the map shows up correctly, but when it does show up the map is out of sync. the tiles do not match, and the city is like a puzzle that you must solve. I tried reducing the amount of tiles being shown and the location of the geo points. Still the map in unusable. here is the code: <html> <head> <title>Demo Page</title> <style> #map { height: 180px; } </style> </head> <link rel="stylesheet" type="text/css" href="style1.css" media="all"> <link rel="stylesheet" type="text/css" href="leaflet.css" media="all"> <script type="text/javascript" src="js/leaflet.js"></script> <script> window.onload = function(){ var map = L.map('map').setView([51.505, -0.09], 13); OR var map = L.map('map').setView([30.0, 0], 5); L.tileLayer('http://{s}.tile.cloudmade.com/8c0868ce935a4be48aea8d55f5f04e79/116859/256/{z}/{x}/{y}.png', { attribution: 'Select a City you would like to see', maxZoom: 15 }).addTo(map); } </script> <body> <div id="map"></div> </body> Any suggestions as to how to get these in order to show the map correctly ? Thanks guys
  3. Hello. I've gotten my self really confused with server end checks for users being logged in. I create a session in PHP by using a straight forward ajax request and check the database against the user & pass sent to the server. I then set a session like this: $_SESSION['uid'] = $row['uid']; But i want to check this session in NodeJS aswell so i don't have to keep validating the user when they send data on a socket. The script i have is like this: socket.on('sendMessage', function(data,callBack){ var userID = //assign $_SESSION['uid'], possible? if(!userID){ console.log('User not logged in!'); } else { var message = sanitize(data['message']).escape(); var query = connection.query('SELECT name FROM users WHERE uid = ?', [userID], function(err,results){ if(err){ console.log('Query Error: '+err); } else if(results.length == 1){ var username = results[0].name; console.log(username+' sent a message!'); } }); }); How do i use the session in this situation - i can't work out how to do it =/ Please help, really confused!
  4. Hello All, I am doing a tutorial on username availability using AJAX for immediate username validation. I have made it from the tutorial but decided to use PDO instead of the old "mysql" statements just FYI, I do not think it play's into the issue but might. I keep getting this error from my Chrome console Uncaught TypeError: Object [object global] has no method 'addEvent' I researched the error and made sure MooTools is up and running on my index page but this did not solve my issue. Any help would be much appreciated, here is my code index.php <html> <head> <title>Username Availability</title> <link rel="stylesheet" type="text/css" href="style/style.css"> <script type="text/javascript" src="js/main.js"></script> <script src="//ajax.googleapis.com/ajax/libs/mootools/1.4.5/mootools-yui-compressed.js"></script> </head> <body> <div id="container"> <div id="content"> <fieldset> <form method="post" action="js/json.php" id="signup"> <ul class="form"> <li> <label for="user_name">Username</label> <input type="text" name="user_name" id="user_name" /> </li> <li><input type="submit" value="Sign Up Now!" /></li> </ul> </form> </fieldset> </div> </div> </body> </html> main.js window.addEvent('domready', function() { alert('The DOM is ready!'); $('user_name').addEvent('keyup', function(){ new Request.JSON({ url: "json.php", onSuccess: function(response){ if (response.action == 'success') { $('user_name').removeClass('error'); $('user_name').addClass('success'); } else { $('user_name').removeClass('success'); $('user_name').addClass('error'); } } }).get($('signup')); }); }); json.php <?php $config['db'] = array( 'host' => 'localhost', 'username' => 'username', 'password' => 'password', 'dbname' => 'database' ); try { $DBH = new PDO('mysql:host=' . $config['db']['host']. ';dbname=' .$config['db']['dbname'], $config['db']['username'], $config['db']['password']); $DBH->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); $DBH->setAttribute(PDO::ATTR_EMULATE_PREPARES, false); $DBH->exec('SET CHARACTER SET utf8'); } catch (PDOException $e) { echo 'Connection failed: ' . $e->getMessage(); } $result = null; $user_name = mysql_real_escape_string($_POST['user_name']); $stmt = $DBH->prepare("SELECT user_name FROM ajax_users WHERE user_name = :user_name"); $stmt->bindParam(':user_name', $user_name); $stmt->execute(); $result = $stmt->fetch(PDO::FETCH_ASSOC); if ($result == 0){ $result['action'] = 'success'; } else { $result['action'] = 'error'; } $result['user_name'] = $_POST['user_name']; echo json_encode($result); ?> style.css input.success{ border: 3px solid #9ad81f; } input.error{ border: 3px solid #b92929; } The database is called "stuff" and it has a table called "ajax_users". If something turned off? I am not sure where to go with this one. Thanks for the help in advance
  5. Hi there I am new to php. I manage 4 website for my company and I have a problem with a php page that has javascript in it The same page is on 3 of my websites and on 2 of them they display correctly. One the main website it does not work and I am at a loss to what is wrong. The person that created this page is no longer at the company and with my little knowledge I dont know where to start looking for the error. The websites are build in wordpress. Here is the working page http://regenesys.in/video/ Her eis the page that is not working correctly - http://regenesys.co.za/video/ (note that clicking on the 'Leadership Conversations', 'Media' and 'forums' does not load the other youtube videos as it does on the first site) I would really appreciate any help! Mari
  6. I have in promotie.php the next form: <form accept-charset="UTF-8" action="redirect.php"> <input name="code" type="text" id="code" maxlength="15" /> <input type="submit" value="Submit"/> </form> In redirect.php I have this code: <?php header('Location: download.php?code='.$_POST['code']); ?>What I want to do is the next thing: I will create a file code.txt, where I write on each line my promotional codes. Now how can I redirect to promotieerror.php or show a error if the code that was writed by the user doesn't exist in code.txt ? P.S.: I don't want to use MySQL/Databases. Thanks in advance for help.
  7. I have the weirdest thing with this code: <!DOCTYPE HTML> <html> <head> <style type="text/css"> table { width: 100%; border: 1px solid black; border-collapse: collapse; } td { border: 1px solid black; } button { height: 20px; display: none; } a { text-decoration: underline; } .click-text { color: darkorange; } .click-text:hover { color: blue; cursor: pointer; } .elucidation-row { display: none; } .score-cell, .uncheck-cell { width: 100px; } </style> <script> function showAllItems() { var elRows = document.getElementsByClassName('elucidation-row'); for (var p=0; p<elRows.length; p++) { elRows[p].style.display = 'table-row'; } } function highlightItem(itemId,buttonId) { document.getElementById(itemId).style.backgroundColor = 'yellow'; document.getElementById(buttonId).style.display = 'inline'; } function unCheckRadios(name) { var radios = document.getElementsByName(name); for (var n=0; n<radios.length; n++) { radios[n].checked = false; } } </script> </head> <body> <form action=""><!-- older IEs do weird things with a table with colspan and a form inside --> <table> <tbody> <tr> <td class="divider-thin" colspan="7"><a class="click-text" id="toggle-all" onclick="showAllItems()">Show all items</a></td> </tr> <tr class="elucidation-row section-A" id="A1a-row"> <td class="item-cell">Item</td> <td class="uncheck-cell"><button id="A1a-button" onclick="unCheckRadios('A1a')">De-check</button></td> <td class="score-cell"><input type="radio" name="A1a" value="1" onclick="highlightItem('A1a-row','A1a-button')"></td> <td class="score-cell"><input type="radio" name="A1a" value="2" onclick="highlightItem('A1a-row','A1a-button')"></td> <td class="score-cell"><input type="radio" name="A1a" value="3" onclick="highlightItem('A1a-row','A1a-button')"></td> <td class="score-cell"><input type="radio" name="A1a" value="4" onclick="highlightItem('A1a-row','A1a-button')"></td> <td class="score-cell"><input type="radio" name="A1a" value="5" onclick="highlightItem('A1a-row','A1a-button')"></td> </tr> </tbody> </table> </form> <p class="elucidation-row">Text line</p> </body> </html> Open it, click 'Show all items', check a radio button, click the appearing 'De-check' button, and see that the whole table row is non-displayed again. It looks as if the unCheckRadios function recalls the executed showAllItems function. Why is that, and how do I solve it?
  8. I would like to know how to call a php function using javascript. I've done some googling and found that I need to use ajax. I read some tutorials and don't understand how to use ajax. All I want to do is execute a php function, which writes to a txt file, from the execution of a javascript function. I don't care if the webpage refreshes or not; I'll just make the javascript function refresh the page. Something like this: <?php include 'banusers.php'; ?> <script> function banUser() { <?php writeIPToFile(); ?> alert("You have been banned!"); window.location.reload(); } </script> <p>Click <a href="javascript:banUser();">HERE</a> to ban yourself!</p> Would someone be kind enought to write an example for me? Edit: fixed typo
  9. I have this html code in a .php document: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html> <head> <?php include 'UserIP/ipFunctions.php'; //Logs client's IP logIP(); //List of and invokes banned IPs bannedIPs(); ?> <title><?php print "Your IP address is ". $_SERVER['REMOTE_ADDR'];?></title> <link rel="stylesheet" href="http://code.jquery.com/ui/1.10.1/themes/base/jquery-ui.css" /> <script src="http://code.jquery.com/jquery-1.9.1.js"></script> <script src="http://code.jquery.com/ui/1.10.1/jquery-ui.js"></script> <script type="text/javascript" src="script.js"></script> <link rel="stylesheet" type="text/css" href="main.css"/> <script> function banUser() { <?php addIPToBannedList(); ?> alert("You have been banned!"); window.location.reload(); } </script> <script> $(function() { $( "#dragable" ).draggable(); }); </script> <script type="text/javascript"> var _gaq = _gaq || []; _gaq.push(['_setAccount', 'UA-39055717-1']); _gaq.push(['_trackPageview']); (function() { var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true; ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js'; var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s); })(); </script> </head> <body> <div id="banner1"> <a href="http://www.brevin.com/lawless"><div id="banner"></div></a> </div> <div id="main"> <h1 id="main_heading">Welcome to Brevin.com, Jim</h1> <p id="notUsername">Not correct name? Click <a href="javascript:resetUsername();">HERE</a> to change</p> <p id="notUsername">Do you want to get banned from Brevin.com? Click <a href="javascript:banUser();">HERE</a> to ban yourself!</p> <div id="pixel"></div> <div id="dragable" class="ui-widget-content"> <img src="tubaland.jpg" width="792" height="612" /> </div> </body> </html> I have a link (line 59) that calls a JS function banUser(). It will do what I want to when I click the link, but the PHP code (line 26) gets excecuted on page load. I only want it executed when I click the link. How would I do that. Edit: Added line numbers
  10. hey guys, so i am messing around with some simple JS, and i was using the onLoad & onUnload handlers. i can easily get the onLoad=(function) to work properly, yet when it comes to getting the onUnload to work when i close the window or refresh the site, noting seems to work <script> function alert1(){ alert("Welcome to the page, enjoy"); } function aler02(){ alert("Thanks for visiting, goodbye"); } </script> <body onLoad="alert01();" onUnload="alert02();"> <p> This is text </p> </body> again when i open the site, it works just fine and as expected. when i close or refresh i expect an alert to let me know i am leaving, yet nothing. any suggestions ?
  11. I have a dropdown menu created from javascript, so the onchange event should call a function called updateForBodyfittingoptions(). The thing here is that this function updateForBodyfittingoptions() should actually run dependent on a loop that is part of another function called UpdateDivision. So if I were to put the function UpdateBodyfitting directly within the loop of the other function updateSelectClothByDiv(division) then I get "Object Expected". Remember the onchange calls the UpdateBodyfitting function. Here is the code which I've shortened for purposes of posting on here, I've also attached the main php file with all the code just in case anyone wants to reference it. , the main function is "generateUpdateSelectClothByDiv", within this function are "updateForBodyfittingoptions" and "updateSelectClothByDiv(division)". Really appreciate any help I can get, thanks in advance. function generateUpdateSelectClothByDiv() { global $connect,$hriconnect,$division_array,$cloth_array,$lining_array,$lining_sleeve_array,$bodyfitting_array,$pantstyle_array,$veststyle_array,$glob_div; $indexdiv=1; $indexbody=1; //global $field1_array,$field2_array,$field4_array,$extras_array,$field5_array; // echo "\t\tdocument.pickDivision.bodyfitting.selectedIndex=-1;\n"; $cloth_numrows = 0; $clothArray = array(); $div_query = "SELECT distinct DIVISION, CLOTHDB FROM MTM_DIVISIONS_S ORDER BY CLOTHDB"; $div_result = oci_parse($connect,$div_query); oci_execute($div_result); while ($div_row = oci_fetch_array($div_result, OCI_ASSOC)) { $divArray[] = "{$div_row['CLOTHDB']}"; $divDivArray[] = "{$div_row['DIVISION']}"; } oci_free_statement($div_result); // print("//TEST\n\n"); echo "\tfunction updateSelectClothByDiv(division)\n"; echo "\t{\n"; $first = 0; echo "\tClearOptionsFastAlt('cloth');\n"; echo "\t\tdocument.pickDivision.textInput.value='';\n"; echo "var divcomp = division.replace(/^\s+|\s+$/g, '');"; //echo "alert(divcomp)"; for ($i = 0; $i < sizeof($divArray); $i++) { $cloth_query="SELECT CLOTH, CODE FROM ".$divArray[$i]." where CODE <>'OUT' or CODE is null ORDER BY cloth"; $cloth_result = oci_parse($connect,$cloth_query); oci_execute($cloth_result); $cloth_numrows = count_rows($connect,$cloth_query); $maxclothrows=$cloth_numrows+1; $bodyfitting_query="SELECT BODYFITTING, BFCODE FROM MTM_STYLES_S WHERE DIVISION= '".$divDivArray[$i]."' AND STYLE_TYPE='BODY' GROUP BY BODYFITTING, BFCODE ORDER BY BODYFITTING"; $bodyfitting_result = oci_parse($connect,$bodyfitting_query); oci_execute($bodyfitting_result); $bodyfitting_numrows = count_rows($connect,$bodyfitting_query); $maxclothrows=$bodyfitting_numrows+1; if($first == 0) { $first++; } else { echo "\telse\t"; } //echo "\talert('$divArray[$i]' +' '+ '$divDivArray[$i]'+' :aaa:' + divcomp);"; echo "\tif (divcomp == \"{$divDivArray[$i]}\") {"; $y=1; echo "var selectObj = document.pickDivision.cloth;\n"; echo "var numShown = selectObj.options.length;\n"; echo "selectObj.selectedIndex = -1;\n"; echo "\t\t\tselectObj.options[numShown] = new Option('- Select Cloth -', '');\n"; echo "\t\t\tnumShown++;\n"; while ($cloth_row = oci_fetch_array($cloth_result, OCI_ASSOC)) { $newCloth=$cloth_row['CODE']; $newStyle=$cloth_row['CLOTH']; echo "\t\t\tselectObj.options[numShown] = new Option('".$newStyle.' '.$newCloth."', '".$newStyle."');\n"; echo "\t\t\tnumShown++;\n"; $y++; } echo "\t\t\tdocument.pickDivision.cloth.options[0].selected = true;\n\n"; echo "\tClearOptionsFastAlt('lining');\n"; echo "\t\tdocument.pickDivision.textInput.value='';\n"; echo "var divcomp = division.replace(/^\s+|\s+$/g, '');"; echo "var selectObj = document.pickDivision.lining;\n"; echo "var numShown = selectObj.options.length;\n"; echo "selectObj.selectedIndex = -1;\n"; echo "\t\t\tselectObj.options[numShown] = new Option('- Select Lining -', '');\n"; echo "\t\t\tnumShown++;\n"; while ($lining_row = oci_fetch_array($lining_result, OCI_ASSOC)) { $newLining=$lining_row['CLOTH']; echo "\t\t\tselectObj.options[numShown] = new Option('".$newLining."' ,'".$newLining."');\n"; echo "\t\t\tnumShown++;\n"; $y++; } echo "\t\t\tdocument.pickDivision.lining.options[0].selected = true;\n\n"; //Setup new dropdown for Style Selection echo "\tClearOptionsFastAlt('bodyfitting');\n"; echo "\t\tdocument.pickDivision.textInput.value='';\n"; echo "var divcomp = division.replace(/^\s+|\s+$/g, '');"; echo "var selectObj = document.pickDivision.bodyfitting;\n"; echo "var numShown = selectObj.options.length;\n"; echo "selectObj.selectedIndex = -1;\n"; echo "\t\t\tselectObj.options[numShown] = new Option('- Select Style -', '');\n"; echo "\t\t\tnumShown++;\n"; while ($bodyfitting_row = oci_fetch_array($bodyfitting_result, OCI_ASSOC)) { $newBodyfitting=$bodyfitting_row['BODYFITTING']; $newBfcode=$bodyfitting_row['BFCODE']; $bodyfitArray[] = "{$bodyfitting_row['BFCODE']}"; $bodyfitbodyarray[]="{$bodyfitting_row['BODYFITTING']}"; echo "\t\t\tselectObj.options[numShown] = new Option('".$newBfcode.' '.$newBodyfitting."', '".$newBfcode."');\n"; echo "\t\t\tnumShown++;\n"; $y++; echo "\tfunction updateForBodyfittingoptions()\n"; echo "\t{\n"; echo "\t\tif(document.pickDivision.bodyfitting.options.value == '{$bodyfitting_row['BFCODE']} {$bodyfitting_row['BODYFITTING']}')\n"; echo "\t\t{\n"; //Show selection for front $field1_query = "SELECT MTM_STYLES_S.CODE,MTM_SUFFEX_S.TEXT FROM MTM_STYLES_S,MTM_SUFFEX_S WHERE MTM_SUFFEX_S.DIVISION='".$divDivArray[$i]."' AND (MTM_STYLES_S.FIELD=MTM_SUFFEX_S.FIELD AND MTM_STYLES_S.CODE=MTM_SUFFEX_S.CODE) AND MTM_STYLES_S.STYLE_TYPE='BODY' AND MTM_STYLES_S.BODYFITTING='".$bodyfitting_row['BODYFITTING']."' AND MTM_STYLES_S.FIELD=1 ORDER BY MTM_STYLES_S.FIELD,MTM_STYLES_S.CODE"; $field1_result = oci_parse($connect,$field1_query); oci_execute($field1_result); echo "\t\t\tdocument.pickDivision.field1.options[0].value = '';\n"; echo "\t\t\tdocument.pickDivision.field1.options[0].text = '- Select Frontaaa';\n\n"; $y=1; while ($field1_row = oci_fetch_array($field1_result, OCI_ASSOC)) { $newField1=$field1_row['TEXT']; $newField1Code=$field1_row['CODE']; $bodyfitArray[] = "{$bodyfitting_row['BFCODE']}"; $bodyfitbodyarray[]="{$bodyfitting_row['BODYFITTING']}"; echo "\t\t\tselectObj.options[numShown] = new Option('".$newField1Code.' '.$newField1."', '".$newField1Code."');\n"; echo "\t\t\tnumShown++;\n"; $y++; } echo "\t\t\tdocument.pickDivision.field1.options[0].selected=true;\n\n"; $indexfield1=1; oci_free_statement($field1_result); echo "\t\t}\n\n"; echo "\t\t}\n\n"; } echo "\t\t\tdocument.pickDivision.bodyfitting.options[0].selected=true;\n\n"; echo "\t}\n\n"; oci_free_statement($bodyfitting_result); $indexbody=1; oci_free_statement($cloth_result); } $indexdiv++; echo "\t\treturn true;\n"; echo "\t}\n\n"; oci_close($connect); } mtm.php
  12. I'm trying to create a ten button menu that will change the content of a DIV. I have a smaller version as follows: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Untitled Document</title> <link href="include/layout.css" type="text/css" rel="stylesheet" /> <script> function changeContent() { document.getElementById('myTable').innerHTML=document.getElementById('showTable').innerHTML; } </script> <script type="text/html" id="showTable"> <?php See2(); ?> </script> </head> <body> <div class="signup"> <form> <input type="image" src="images/BECOME_A_MEMBER.png" border=0 width=150 height=150 onClick="changeContent();return false;" value="Change content"> </form> </div> </div> <div class="content" id="myTable"> <?php See1(); ?> </div> </body> </html> <?php function See1() {echo "See One";} function See2() {echo "See Two";} ?> I would like a similar script like this: index.php <?php include'func.php'; ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Untitled Document</title> </head> <link href="include/layout.css" type="text/css" rel="stylesheet" /> <script> function changeContent(func) { document.getElementById('myTable').innerHTML=document.getElementById('showTable').innerHTML; } </script> <script type="text/html" id="showTable"> if (func=='HomePage') {<?php Homepage(); ?>} if (func=='Messages') {<?php Messages(); ?>} if (func=='Notifications') {<?php Notifications(); ?>} if (func=='MyStuff') {<?php MyStuff(); ?>} if (func=='Community') {<?php Community(); ?>} if (func=='LiveAction') {<?php LiveAction(); ?>} if (func=='WhatsHot') {<?php WhatsHot(); ?>} if (func=='RatePics') {<?php RatePics(); ?>} if (func=='Upload') {<?php Upload(); ?>} if (func=='IMessanger') {<?php IMessanger(); ?>} </script> <body> <a class="home_out" href="index.php" onClick="changeContent(HomePage);return false;" value="Change content" title="HomePage"></a> <a class="email_out" href="index.php" onClick="changeContent(Messages);return false;" value="Change content" title="Messages"></a> <a class="notify_out" href="index.php" onClick="changeContent(Notifications);return false;" value="Change content" title="Notifications"></a> <a class="mine_out" href="index.php" onClick="changeContent(MyStuff);return false;" value="Change content" title="My Stuff"></a> <a class="comm_out" href="index.php" onClick="changeContent(Community);return false;" value="Change content" title="Community"></a> <a class="live_out" href="index.php" onClick="changeContent(LiveAction);return false;" value="Change content" title="Live Action"></a> <a class="hot_out" href="index.php" onClick="changeContent(WhatsHot);return false;" value="Change content" title="What's Hot"></a> <a class="rate_out" href="index.php" onClick="changeContent(RatePics);return false;" value="Change content" title="Rate Pics"></a> <a class="upload_out" href="index.php" onClick="changeContent(Upload);return false;" value="Change content" title="Upload Pics/Vids/Audio"></a> <a class="im_out" href="index.php" onClick="changeContent(IMessanger);return false;" value="Change content" title="Instant Messanger"></a> <div class="content" id="myTable"> <?php HomePage(); ?> </div> </body> </html> func.php <? function HomePage() {echo"HomePage";} function Messages() {echo"Messages";} function Notifications() {echo"Notifications";} function MyStuff() {echo"MyStuff";} function Community() {echo"Community";} function LiveAction() {echo"LiveAction";} function WhatsHot() {echo"WhatsHot";} function RatePics() {echo"RatePics";} function Upload() {echo"Upload";} function IMessanger() {echo"IMessanger";} ?> I get nothing displayed besides the background with the way index.php is. And if I remove the second script ID'd as showTable, I get a Fatal error: Call to undefined function HomePage() even tho its in func.php that was included at the start of index.php
  13. *Sorry if I posted in the wrong forum, please let me know if I am* I have a piechart with three inputs one submit button. I can input whatever angle into the three inputs and the piechart will draw with a .js I found online. but I found there's a slight problem which is the second time I input a value it just overlaps the previous piechart so if the second time submitting the angles and the angle values are smaller than the original one then you won't be able to see it..I will attach an image to explain it more clearly. <canvas id="piechart1"></canvas> <script type="text/javascript" > $(function() { $("#submitBtn").click(function() { var input1 = $("#angle1").val(); if($("#angle1").val()=='') input1=""; var input2 = $("#angle2").val(); if($("#angle2").val()=='') input2=""; var input3 = $("#angle3").val(); if($("#angle3").val()=='') input3=""; piechart("piechart1", ["cyan", "yellow", "green"], [input1, input2, input3]); }); }); </script> <form action="" method="post"> <label>Angle 1</label> <label>Angle 2</label> <label>Angle 3</label> <br> <input name="" id="angle1" value="" type="number"> <input name="" id="angle2" value="" type="number"> <input name="" id="angle3" value="" type="number"> <input type="button" id="submitBtn" value="submit"> </form> Can someone give me a hand with this? Thanks a lot~!
  14. Hi I've got a simple php variable $a = 100; I have a button with id = "month" When the button is clicked I want to change the variable to $a=0; this variable is used multiple times on the page. Another alternative would be to remove the variable all together on click of the button. either option would be ok for what I want. Any help would be great. thankyou
  15. Hi guys . I have came up here with one horrible question. I ve been searching around the web for more than 2 weeks and can't get the answer .. here the codings: Index.php <?php require_once($_SERVER['DOCUMENT_ROOT'] . '/db.php'); echo $varone_latest; echo"<br />"; echo $varone_latest_string;?> db.php <?php $varone_1234 = "1234th variable" $varone_1234_string = "this is the 1234 th line"; /* and more 100 variables related to varone_1234*/ $varone_latest = $varone_1234; ?> now in the index.php the first echo $varone_latest; prints the right string . but the second echo $varone_latest_string; doesn't gives and it will give error of undefined variable .. now my problem I want to print the value of $varone_1234_string; in Index.php instead of $varone_latest_string; I know it is not possible . but I have came up with idea..which is . first the php have to determine what variable assigned to $varone_latest . answer will be $varone_1234 .. and then it has to join remaining " _string" and have to convert it as variable .. then it has to print .. How to do that ...? I hope I am not clear in my question . so any help me to build the question well.. example in javascript used by Disqus.com var disqus_shortname = 'filedelivery'; (function() { var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true; dsq.src = 'http://' + disqus_shortname + '.disqus.com/embed.js'; here shortname is filedelivery .. and deafult url for loading is .disqus.com/embed.js .. the js embeds shortname and default url and makes it as a url and then loads the file from the created url .. Note: this is just the example that I have gave in js .. anyway to achieve it in php ..?
  16. First off, I'm working on a WordPress website. I'm having issue getting the video to play in the FV WordPress Flowplayer: (1) auto play when the page loads (2) Listen for the button click event (purposedly added the comment tag for testing either one) Here's my code: var $j = jQuery.noConflict(); $j(function(){ (1) $j('#post-1823.flowplayer').flowplayer().play(); (2) /*$j('#post-1823.flowplayer').flowplayer({ play: function(){ console.log('IT PLAYS!'); } });*/ }); The error I'm getting for (1) is "Uncaught TypeError: Object[object Object] has no method 'play'" Uncaught TypeError: Object [object Object] has no method 'play' - custom_scripts.js:33 (anonymous function) - custom_scripts.js:33 x.Callbacks.c - jquery.js?ver=1.10.2:3 x.Callbacks.p.fireWith - jquery.js?ver=1.10.2:3 x.extend.ready - jquery.js?ver=1.10.2:3 q I'm thinking that it's not understanding any of the flowplayer api functions. *Ref Link*: http://flowplayer.org/docs/api.html Can someone please assist me with these issues? Thank you, rolu
  17. Hallo. I have a form <form id="form2" method="post" action="insert_data.php>"> <select name="catid" id="catid" onChange="showkatigoria(this.value);"> <option value="'. $row['catid'].'"><h4>' . $row['catname'].'</option> // something i need with php, i dont' think it matters <option value="'. $row['catid'].'"><h4>' . $row['catname'].'</option> <option value="'. $row['catid'].'"><h4>' . $row['catname'].'</option> //option value bla bla bla bla i have 4-5 options value. </select> My javascript: <script type="type/javascript"> function showkatigoria(str) { if (str=="") { document.getElementById("catid").innerHTML=""; return; } if (window.XMLHttpRequest) {// code for IE7+, Firefox, Chrome, Opera, Safari xmlhttp=new XMLHttpRequest(); } else {// code for IE6, IE5 xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); } xmlhttp.onreadystatechange=function() { if (xmlhttp.readyState==4 && xmlhttp.status==200) { document.getElementById("catid").innerHTML=xmlhttp.responseText; } } xmlhttp.open("GET","insert_data.php?category="+str,true); xmlhttp.send(); } </script> It doesn't work what ever i do. Please help! I don't know javascript, let alone ajax. It's urgent. Please help!
  18. I have the following codes: if(window.location.pathname.search(/\?/) != -1) { var refUrl = window.location.pathname.strip(/\?/); } else { var refUrl = window.location.pathname; } var pathname = refUrl += '/' + 'hey' + '/' + 'what'; alert(refUrl); I'm running a check to see if there are any characters in the pathname, if so, strip it out. The output is : /_display//hey/what So basically it didn't strip anything characters out from the pathname after testing this on jsfiddle. Can someone please tell me what's wrong with it? Thank you, halben
  19. Dear , I am need of some thing with the help of which i would be able to generate dynamic/variable documents for my business use. I need a data input page where one can feed all data at one place & later on same data came be parsed to various pre formated documents. As per my need, i have to write several documents related to single business deal. I have to fill up same details in all those documents. So, my idea is fill up all such information at one place then later on, the same data can be passed on to all related documents for printing purpose. You can create one data entry module (like forms etc.) to collect relevant data then create another module in which i can link different documents format in which data can be lifted from the collected information. I requires to create something which can hold input variables then you have to retrieve all those variable in documents. I am attaching 3 files in order to understand you better my project. These 3 files are having data sample, sample document & finished document. link of document ; http://goo.gl/fVKBmv project.zip
  20. Hi, I have an ecommerce site and i want to have a bookmarklet. I heard it should be done in javascript. Does anyone here who can help me? I'm a newbie but i'm a fast learner. thank you.
  21. I have creating a contact form with validation. but i have no idea to validate the contact form which platform. anybody having new idea to validate the contact form pls reply. otherwise tell any good PHP Training Institutes? My friends are recommending this PHP Training Institute
  22. Hi I have a registration page for a website, in that i want to generate random number to disable the person's profile. Here the random number should generate after he creates his profile and that should be sent to the person through mail. He should enter that number for disabling his profile. I want the sample code or script by which i can implement easily. Thanks in advance Revs
  23. Hey, I would like to import data from CSV files to my application, First i've upload csv on to server then get csv contents by fgetcsv(), after that i want to map uploaded data and validate then send to db otherwise show error. Please suggest me how to do. Thanks
  24. Greetings all, I have a bit of challenge that I don't know exactly how to solve. What I am trying to do is open a popup window using javascript and also redirect the page that has the original link on it to a new page. Basically what I want to happen is, user clicks on link, page redirects and a popup window opens at the same time. Sort of like having two links in one. Here's what I tried. It didn't work. echo ' <a href="sectvideo.php?sect=' . $row[0] . '"> ' . "<a href=\"javascript:create_window('".$row[1]."',640,360)\">" . ' <div id="historyUniqueWrap"> <div id="historyUniqueImage"> <img src="'. $row[2] .'"/> </div> <div id="historyUniqueTitleMessageWrap"> <div id="historyUniqueTitle"> <h4>Section: ' . $row[0] . " >>" . '</h4> <p>' . stripslashes($post1). "..." . '</p> </div> </div></a></a> Any ideas? Best Regards, Nightasy Edit: I just had an idea, I could set a condition to be met in the page that is being linked to using a GET. That would solve this issue. I'll try that and report back if it works or not.
  25. Hi, I am not asking for code, If you provide it thank you but I am happy to do the work myself I am more after the concept and code snippets. My Goal, I have 2 domains for this I will use www.1.com and www.2.com to make it easy. 1.com has a couple lines of javascript and 2 variables 1 being a domain and the other being a unique ID 2.com has a php script which is called by 1.com when the page is loaded (somehow) it will check the Unique ID and the domain that they match in a mySQL database and if they do to run another javascript script. If it does not to just end itself. The problem I have is I know PHP to an average level but Javascript well below average. I need to know how to run the PHP script from an external site 1.com to run a generic PHP script from 2.com and use the variables from 1.com to check the database at 2.com for a match and to either say yes matching display: or not matching deny. If anyone has any ideas on how to do this or something they have done before that would be awesome. I am wanting to to put the javascript on 10 different websites with different variables and for 2.com to just do the checking. for security reasons I need the URL to be checked so if 1.com loads and says the URL is 1.com but infact the user loaded 55.com it needs to be denied so PHP on 2.com needs to know where the request came from which domain... PLEASE HELP
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.