Jump to content

Search the Community

Showing results for tags 'javascript'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • 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

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


AIM


MSN


Website URL


ICQ


Yahoo


Jabber


Skype


Location


Interests


Age


Donation Link

  1. function updateTimers() { //Get the current timestamp now = new Date(); //Iterate through each of the timers for(i=0; i<timers.length; i++) { //Convert end time to timestamp & calc difference endTime = new Date(timers[i].split(' ').join('T')); millisecondsDiff = endTime - now; //Format the diff and display timeDisplay = formatTimeDiff(millisecondsDiff); document.getElementById('timer['+i+']').innerHTML = timeDisplay; } } I'm using the above function to set timers for a page on my website. It should be showing 23 minutes but is showing 83 minutes. This has only come about since the clocks in the UK went forward. Ant help?
  2. Here is a script i wrote so i could refresh a div with content every 5 seconds but for some reason it doesnt work ... i wanted it to load it with the page then start the refresh i didnt want it to have to wait for the refresh to show up. <script type="text/javascript"> function page_load(){ $('#contentforads').load('<?php print $actual_link ?>/ads.php').fadeIn("slow"); } function refresh(){ page_load() var auto_refresh = setInterval(page_load(),5000); } </script>
  3. I am running this query and the only thing i want is the title and for some reason it is giving me this. Recourse id # 7 ? Here is my query that i am running. $photo = $_GET['image']; $retrievetitle = "SELECT title FROM photo_from_user WHERE picture = '$photo' limit 1"; $title = mysql_query($retrievetitle);
  4. Hi I want to submit the form automatically after sometime,. I have written the code , but its not redirecting/submitting. Don't know why.. Have a look Thanks <!DOCTYPE html> <html> <head> <script type="text/javascript"> setTimeout(function(){document.getElementById("exam").submit()},2000); </script> </head> <body> <?php date_default_timezone_set('Asia/Kolkata'); echo"Start Time: ".$starttime=date('H:i:s')."<br/><br/>"; $startstamp=time(); ?> <form action="inde x1.php" method="post" id="exam" name="exam"> Q1 Your Gender<br/> <input type="radio" value="male" name="gender"> Male <input type="radio" value="female" name="gender"> Female <br /><br /><br /> Q2 You Married<br/> <input type="radio" value="yes" name="marriage"> Yes <input type="radio" value="female" name="marriag e"> No <br /><br /><br /> Q3 2+2<br/> <input type="radio" value="4" name="add"> 4 <input type="radio" value="22" name="add"> 22 <input type="hidden" value="<?php echo $starttime; ?>" name="starttime"><br/> <input type="hidden" value="<?php echo $startstamp; ?>" name="startstamp"><br/> <input type="submit" name="submit"> </form> </body> </ html>
  5. Hello all, I am designing a program that consists of 1 dropdown list that pulled the value from the ORACLE DB and update the value as we change the Dropdown. I can get everything works except the submit button when we want to update the value. Please help me, I know this is a very simple problem but somehow it doesnt work. Your help with greatly appreciated. Thanks, // ASSUME CONNECTION IS DONE if (isset($_POST["ajax"]) && $_POST["ajax"] == 1) { $sql = "SELECT QTY FROM FABRICATION WHERE HEAD_MARK = '{$_POST["hm"]}'"; $cutting_sql = "SELECT CUTTING FROM FABRICATION WHERE HEAD_MARK = '{$_POST["hm"]}'"; $assembly_sql = "SELECT ASSEMBLY FROM FABRICATION WHERE HEAD_MARK = '{$_POST["hm"]}'"; $welding_sql = "SELECT WELDING FROM FABRICATION WHERE HEAD_MARK = '{$_POST["hm"]}'"; $drilling_sql = "SELECT DRILLING FROM FABRICATION WHERE HEAD_MARK = '{$_POST["hm"]}'"; $finishing_sql = "SELECT FINISHING FROM FABRICATION WHERE HEAD_MARK = '{$_POST["hm"]}'"; $stid = oci_parse($conn, $sql); $stid_cutting = oci_parse($conn, $cutting_sql); $stid_assembly = oci_parse($conn, $assembly_sql); $stid_welding = oci_parse($conn, $welding_sql); $stid_drilling = oci_parse($conn, $drilling_sql); $stid_finishing = oci_parse($conn, $finishing_sql); // The defines MUST be done before executing oci_define_by_name($stid, 'QTY', $qty); oci_execute($stid); oci_define_by_name($stid_cutting, 'CUTTING', $cutting); oci_execute($stid_cutting); oci_define_by_name($stid_assembly, 'ASSEMBLY', $assembly); oci_execute($stid_assembly); oci_define_by_name($stid_welding, 'WELDING', $welding); oci_execute($stid_welding); oci_define_by_name($stid_drilling, 'DRILLING', $drilling); oci_execute($stid_drilling); oci_define_by_name($stid_finishing, 'FINISHING', $finishing); oci_execute($stid_finishing); // Each fetch populates the previously defined variables with the next row's data oci_fetch($stid); oci_fetch($stid_cutting); oci_fetch($stid_assembly); oci_fetch($stid_welding); oci_fetch($stid_drilling); oci_fetch($stid_finishing); //echo quantity to the screen echo "<b><font size='10'>".$qty."</font></b></br>"; if ($cutting == $qty){ echo "<p><b><font color='#FF8566' size='5'>CUTTING COMPLETED</font></b></p>"; } else { $maxcutting = $qty - $cutting; echo "<input id='cutting' name='cutting' type='number' min = '0' max = '$maxcutting' placeholder='CUTTING PROGRESS TODAY' class='input'/>"; } if ($assembly == $qty){ echo "<p><b><font color='#FF8566' size='5'>ASSEMBLY COMPLETED</font></b></p>"; } else { $maxassembly = $qty - $assembly; echo "<input id='assembly' name='assembly' type='number' min = '0' max = '$maxassembly' placeholder='ASSEMBLY PROGRESS TODAY' class='input'/>"; } if ($welding == $qty){ echo "<p><b><font color='#FF8566' size='5'>WELDING COMPLETED</font></b></p>"; } else { $maxwelding = $qty - $welding; echo "<input id='welding' name='welding' type='number' min = '0' max = '$maxwelding' placeholder='WELDING PROGRESS TODAY' class='input'/>"; } if ($drilling == $qty){ echo "<p><b><font color='#FF8566' size='5'>DRILLING COMPLETED</font></b></p>"; } else { $maxdrilling = $qty - $drilling; echo "<input id='drilling' name='drilling' type='number' min = '0' max = '$maxdrilling' placeholder='DRILLING PROGRESS TODAY' class='input'/>"; } if ($finishing == $qty){ echo "<p><b><font color='#FF8566' size='5'>FINISHING COMPLETED</font></b></p>"; } else { $maxfinishing = $qty - $finishing; echo "<input id='finishing' name='finishing' type='number' min = '0' max = '$maxfinishing' placeholder='FINISHING PROGRESS TODAY' class='input'/>"; } echo '<section></br></br></br>'; echo ' <input type="submit" value="SUBMIT PROGRESS" class="button red" />'; echo ' <input type="reset" value="RESET FIELDS" class="button" /></br>'; echo ' <input type="button" value="GO TO PAINTING" name="paint" class="button green" /></section>'; if (isset($_POST['paint'])){ echo 'GO TO THE NEXT PAGE'; } if (isset($_POST['submit'])){ echo 'DO SUBMISSION TO THE DATABASE HERE'; } die;} ?> <!-- HTML CODE --> <!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"> <title> Update Fabrication Progress</title> <link type="text/css" rel="stylesheet" href="../css/goldenform/golden-forms.css"/> <link type="text/css" rel="stylesheet" href="../css/goldenform/font-awesome.min.css"/> <script type="text/javascript"> function OnSelectionChange (select) { var selectedOption = select.options[select.selectedIndex]; //some ajax checkpoint //alert ("The selected option is " + selectedOption.value); jQuery.ajax({ url: location.href, data: {'hm':selectedOption.value, 'ajax':1}, type: "POST", success: function( data ) { jQuery("#lbl_qty").html(data);//PRINT QTY TO THE SCREEN } }); //some ajax checkpoint //alert('after ajax'); } </script> <script src="http://code.jquery.com/jquery-1.8.2.min.js"></script> </head> <body class="bg-wooden"> <div class="gforms"> <div class="golden-forms wrapper"> <form> <div class="form-title"> <h2>FABRICATION UPDATE</h2> </div><!-- end .form-title section --> <div class="form-enclose"> <div class="form-section"> <fieldset> <legend>&nbsp Select HEADMARK and the details will be shown <span class="bubble blue">1</span></legend> <section> <div class="row"> <div class="col4 first"> <label for="headmark" class="lbl-text tleft">HEADMARK :</label> </div><!-- end .col4 section --> <div class="col8 last"> <!-- POPULATED DROPDOWN LIST FROM THE DB --> <label for="headmark" class="lbl-ui select"> <?php $sql_hm_comp = 'SELECT HEAD_MARK FROM FABRICATION'; $result = oci_parse($conn, $sql_hm_comp); oci_execute($result); echo '<SELECT name="headmark" id="headmark" onchange="OnSelectionChange(this)">'.'<br>'; echo '<OPTION VALUE=" ">'."".'</OPTION>'; while($row = oci_fetch_array($result,OCI_ASSOC)){ $HM = $row ['HEAD_MARK']; echo "<OPTION VALUE='$HM'>$HM</OPTION>"; } echo '</SELECT>'; ?> </label> </div> </div> </section><!-- END OF DROPDOWN LIST --> <section> <div class="row"> <div class="col4 first"> <label for="lnames" class="lbl-text tleft">Total Quantity:</label> </div> <div class="col8 last"> <!-- VALUE PASSED FROM AJAX PROCESSING --> <label id='lbl_qty' class='lbl-ui'><font size='3'></font></label> </div> </div> </section> </div> </div> <div class="form-buttons"> </div> </form> </div> </div> <div></div> <div></div> </body> </html>
  6. javascript is not looping with mysql_fetch_array result even though it showing timer on one product only .i don't know what mistake i have did ,,plz help me ,,i ma very new with php and java script..even i have taken javascript timer from google itself ..plz help me <?php $conn = mysql_connect('localhost','root',''); if(!$conn) die("Failed to connect to database!"); $status = mysql_select_db('bidding', $conn); if(!$status) die("Failed to select database!"); $result = mysql_query("SELECT * FROM bids where id"); $numrow = mysql_num_rows($result); if ($numrow == 0) { die('No record found.'); } ?> <?php while($row=mysql_fetch_array($result)){ $closedate = date_format(date_create($row['closing_date']), 'm/d/Y H:i:s'); $images_field= $row['image']; $image_show= "images/$images_field"; ?> <div class="bidbar1"> <div id="lastsold"><strong>Last Sold : ₹ </strong><?php echo $row['lastsold']; ?> </div> <div id="title"><?php echo $row['description']; ?></div> <div id="detail"><img src="image/moredetail.jpg" height="150" alt="more detail" /> </div> <div id="image"><img src="<?php echo $image_show; ?>" width="205" height="150" alt="more detail" /></div> <div id="clock"><table><tr><td style="font-size:18px;text-align:center; padding- left:30px;">Days Hr Min Sec</td></tr> <tr><td style="font-size:32px; font:bold; text-align:center;padding-left:30px;"> <script> var cdtd = function(id,end) { var start = new Date(); var timeDiff = end.getTime() - start.getTime(); if(timeDiff <=0 ) { //$('#bidbar1').remove(); //return; // alert('We have lift off!'); //$('#bidbar1').delay(50000000).fadeout(); $(window).load(function(){$('#bidbar1').remove(); }); return false; } var seconds = Math.floor(timeDiff / 1000); var minutes = Math.floor(seconds / 60); var hours = Math.floor(minutes / 60); var days = Math.floor(hours / 24); hours %= 24; minutes %= 60; seconds %= 60; $( id + " .days").html(days); $( id + " .hours").html(hours); $( id + " .minutes").html( minutes); $( id + " .seconds").html( seconds ); console.log(id + " .hoursBox",$( id + " .hoursBox").length,id,end,hours,minutes,seconds) var timer = setTimeout(function(){cdtd(id,end)},1000); } cdtd("#counter1",new Date("<?php echo $closedate; ?>")); //cdtd("#counter2",new Date("march 16, 2014 18:06:30")); //cdtd("#counter3",new Date("march 16, 2014 17:37:00")); //cdtd("#counter4",new Date("march 16, 2014 17:38:00")); //cdtd("#counter5",new Date("june 2, 2014 10:55:00")); //cdtd("#counter6",new Date("April 2, 2014 10:30:00")); //cdtd("#counter7",new Date("April 3, 2014 00:01:00")); //cdtd("#counter8",new Date("April 1, 2014 00:01:00")); //cdtd("#counter9",new Date("April 4, 2014 00:01:00")); //cdtd("#counter10",new Date("April 5, 2014 00:01:00")); //cdtd("#counter11",new Date("April 19, 2014 00:01:00")); //cdtd("#counter12",new Date("April 20, 2014 00:01:00")); </script> <div id="counter1"> <div class="box days">0</div> <div class="box hours">0</div> <div class="box minutes">0</div> <div class="box seconds">0</div> </div> </td></tr></table></div> <div id="mrp"><strong>MRP : ₹</strong><?php echo $row['mrp']; ?></div> <div id="endt"><strong>End Time: ₹</strong><?php echo $row['closing_date']; ?></div> <div id="fee"><strong>Bid Fee : ₹</strong><?php echo $row['bid fee']; ?></div> <div id="current"><strong>Current Winner</br>↓ </strong></div> <div id="buy"> <table width="271" border="0" cellpadding="0.1"> <tr> <td><img src="image/buy.png" alt="buy now" longdesc="http://buy now" /></td> <td width=110><?php echo $row['currentwinner']; ?></td> <td><img src="image/bid.png" alt="bid now" longdesc="http://bidnow " /></td> </tr> </table> </div></div> <?php } ?>
  7. Added animated twitter bird widget code on site.. the bird appears on the site.. but when the bird moves the animation seems out of sink, not smooth.. Have a look at the site. you'll notice the problem when the bird moving... http://www.r7alh.com/ the same code working fine on my localhost. <!-- Twitter Bird Widget for Blogger by Way2blogging.org --> <script type="text/javascript" src="http://widgets.way2blogging.org/blogger-widgets/w2b-tripleflap.js"> </script> <script type="text/javascript"> var twitterAccount = "way2blogging"; var tweetThisText = " <data:blog.pageTitle/> : <data:blog.url/> "; tripleflapInit(); </script> <span style="font-size:11px;position:absolute;"><a title='Blogger Widget by Way2blogging.Org' href="http://www.way2blogging.org" target='_blank'>Blogger Widgets</a></span> <!-- Twitter Bird Widget for Blogger by Way2blogging.org --> The same code working fine on blogs and other websites. only problem is in this site.. http://www.r7alh.com/ what will be the problem? how to fix this? http://www.way2blogging.org/2011/04/add-animated-flying-twitter-bird-widget.html
  8. I need help with my code. I'm trying to make it so that when I hit the withdraw button the money is withdrawn and the new amount is shown in the text box. As of now, when I hit the money buttons the money is withdrawn. The withdraw button does nothing. I can't figure out what I did wrong. assignment7.html
  9. Hello everyone I have an array ( php ) which i want it to use in javascrip. i have used json encode function but this is not the problem. I want to use the values from an array and plot a graph The PHP array looks like this <?php $visits = array( 'UK' => 5, 'US' => 10, 'AS' => 15, 'AD' => 20, 'FG' => 25, 'HF' => 30, 'DG' => 35, 'JH' => 40, 'ET' => 45, 'HG' => 50, 'KT' => 55, 'ER' => 10, 'UI' => 65, 'ER' => 70, 'UY' => 75, 'UT' => 80, 'UK' => 5 ); ?> and the javascript file is <script type="text/javascript"> var arr = "<?php json_encode($visits) ?>"; $(function () { $('#container').highcharts({ chart: { type: 'area' }, title: { text: 'Total Impressions' }, subtitle: { text: '' }, xAxis: { labels: { formatter: function() { return this.value; // clean, unformatted number for year } } }, yAxis: { title: { text: 'Hits' }, labels: { formatter: function() { return this.value / 1000 +'k'; } } }, tooltip: { pointFormat: '{series.name} produced <b>{point.y:,.0f}</b><br/>warheads in {point.x}' }, plotOptions: { area: { pointStart: 1940, marker: { enabled: false, symbol: 'circle', radius: 2, states: { hover: { enabled: true } } } } }, series: [{ name: 'Country', data: [null, null, null, null, null, 6 , 11, 32, 110, 235, 369, 640, --- This are all demo values 1005, 1436, 2063, 3057, 4618, 6444, 9822, 15468, 20434, 24126, | 27387, 29459, 31056, 31982, 32040, 31233, 29224, 27342, 26662, | 26956, 27912, 28999, 28965, 27826, 25579, 25722, 24826, 24605, | <---- This is where i want to loop through the countries from my array 24304, 23464, 23708, 24099, 24357, 24237, 24401, 24344, 23586, | 22380, 21004, 17287, 14747, 13076, 12555, 12144, 11009, 10950, | 10871, 10824, 10577, 10527, 10475, 10421, 10358, 10295, 10104 ] --- }, { name: 'Hits', data: [null, null, null, null, null, null, null , null , null ,null, --- This are all demo values 5, 25, 50, 120, 150, 200, 426, 660, 869, 1060, 1605, 2471, 3322, | 4238, 5221, 6129, 7089, 8339, 9399, 10538, 11643, 13092, 14478, | 15915, 17385, 19055, 21205, 23044, 25393, 27935, 30062, 32049, | <---- This is where i want to loop through the values from my array. 33952, 35804, 37431, 39197, 45000, 43000, 41000, 39000, 37000, | 35000, 33000, 31000, 29000, 27000, 25000, 24000, 23000, 22000, | 21000, 20000, 19000, 18000, 18000, 17000, 16000] --- }] }); }); </script> Any help will be greatly appreciated... Thank in advance,....
  10. I've never understood the application of return true and return false after function calls in JavaScript. Could somebody please explain their meaning. This is a very simple script which will create a popup window for each links in an html document. function createPopup(e) { 'use strict'; // Get the event object: if (typeof e == 'undefined') var e = window.event; // Get the event target: var target = e.target || e.srcElement; // Create the window: var popup = window.open(target.href, 'PopUp', 'height=100,width=100,top=100,left=100,location=no,resizable=yes,scrollbars=yes'); // Give the window focus if it's open: if ( (popup !== null) && !popup.closed) { popup.focus(); return false; // Prevent the default behavior. } else { // Allow the default behavior. return true; } } // End of createPopup() function. // Establish functionality on window load: window.onload = function() { 'use strict'; // Add the click handler to each link: for (var i = 0, count = document.links.length; i < count; i++) { document.links[i].onclick = createPopup; } // End of for loop. }; // End of onload function. The only part of the script that doesn't make sense here is the return true/false. Why do we use return true or return false after calling a JavaScript function?
  11. Hello I'm looknig for a code that can guide me to generate four chained selects with data from mysql database, that let me add new rows to a table that maintain the same logic of the four chained select with data from mysql when I do click an add row button and so on. Anyone can give me a link or download site that I can use to build that I want? Could be a JavaScript, jquery or php code that let me do what I want in HTML. Best Regards
  12. Given the following code: updateTotal: function () { var total = 0; $('input#itemLineTotal').each(function (i) { price = $(this).val().replace("$", ""); if (!isNaN(price)) total += Number(price); }); $('#subTotal').html("$" + this.roundNumber(total, 2)); var grdTotal = total + this.updateSalesTax(); grdTotal = this.roundNumber(grdTotal, 2); $('#grandTotalTop, #grandTotal').html("$" + grdTotal); }, updateSalesTax: function () { var total = 0; $('input#itemLineTotal').each(function (i) { price = $(this).val().replace("$", ""); if (!isNaN(price)) total += Number(price); }); var tax = $("#tax").val(); $("#salesTax").html("$" + mioInvoice.roundNumber(tax, 2)); return tax; }, How can add the tax to the total to give the grand total. Please help
  13. Hi i want to change the attribute of a div id when the div is clicked.. but its not working for some reason ? $('#prev').attr('id',''); $('#next').attr('id','2'); //Pagination Click $(".controls").click(function(){ $("html, body").animate({ scrollTop: 0 }, 700); $('#next').removeattr('id',''); $('#prev').attr('id',''); $('#next').attr('id','7');
  14. Hello mates, I'm a newbie to JavaScript. Normally when I assign an HTML element to a variable created in JavaScript I place the element id in quotes like this: var output = document.getElementById('output'); But there is something new that I've come across: var output = document.getElementById(elementId); elementId is an undeclared parameter and it is without quotes. 'output' in the first snippet refers to <p id="output"></p> in the HTML code. What is surprising to me is that var output = document.getElementById(elementId); works just the same even though there is no HTML element declared with the name elementId. To put this into context, the code is in 2 files; today.html and today.js. today.html: <html> <head> <title>Today</title> </head> <body> <p id="output"></p> <script src="today.js"></script> </body> </html> today.js: function setText(elementId, message) { 'use strict'; if ( (typeof elementId == 'string') && (typeof message == 'string') ) { // Get a reference to the paragraph: var output = document.getElementById(elementId); // Update the innerText or textContent property of the paragraph: if (output.textContent !== undefined) { output.textContent = message; } else { output.innerText = message; } } // End of main IF. } function init() { 'use strict'; var today = new Date(); var message = 'Right now it is ' + today.toLocaleDateString(); message += ' at ' + today.getHours() + ':' + today.getMinutes(); // Update the page: setText('output', message); } // End of init() function. window.onload = init;
  15. Javascript CODE: var m=n=0; function show_services() { m=m+1; n=m+1; if(m==6) {m=6;n=1;} if(m==7) {m=1;n=2;} str1 = "/images/pic" + m + ".PNG"; str2 = "/images/pic" + n + ".PNG"; document.getElementById('w1').innerHTML = str1; document.getElementById('w2').innerHTML = str2; document.getElementById('img1').src = str1; document.getElementById('img2').src = str2; } var my_str = setInterval(function() {show_services()},1000); ############################################################################## <img id="img1" src="/images/pic1.PNG" style="margin-top:30px" height="100px" width="550px"/><br> <img id="img2" src="/images/pic2.PNG" style="margin-top:30px" height="100px" width="550px"/><br> <br> <div id='w1'></div> <br> <div id='w2'></div> ############################################################################## the code is working fine, files have been placed at the right place, str1 and str2 are getting correct values and they are updating at the right time..............I run same code on browser and it works fine, but, when I run the same code on website domain, it does work at all, what can be the reason for this ............
  16. can someone help me?can you make this script?i dont make the script yet. when i click set as correct..., clicked response become correct answer and the other become default. thanks in advance, sorry for my bad english. iam indonesian.
  17. Hi friends, i am new in php, user fill the text box to get the value and post it to the next page using ajax. this is my requirement. i call the textbox in while loop ,so i used the text box name is ship_quantity[] In jquery i get the value like that $('input[name="ship_quantity[]"]').each(function(){ var sq=$(this).val(); alert(sq); now i get the value of 1,2 as user inputs. my questions is how to extract this values and send to ajax post.
  18. Hi guys, I was wondering if i could have some help on a piece of functionality I am trying to implement onto a website I am currently developing. The Scenario is as follows : I have a table residing on a MySql data base called Bookings. The Bookings table consists of a composite primary key based upon the following 2 fields: BookingDate & Booking Slot. On my website, I have built a bookings page which will consist of a a simple HTML Form, which has a Date Field and a Radio-Button group which has 3 different time slots (eg: 9am, 2pm and 4pm). Firstly, the User will select a Date they would wish to place a booking on and then click a submit button called "Check Availablity". Once this button is clicked, Ideally, I would like a script to check an see what free slots are available for that Date and then disable the radio buttons related the slots which are already booked. Here is a simple scenario to help explain the functionality i am trying to implement : The User comes to the Bookings page, and selects the Date 14/03/2011. Then clicks the "Check Availablity" button. In this scenario, the 9am slot is already booked for this date (eg: this booking already exists on the MySql database table), so the 9am radio button on the page is then disabled, not allowing the user to try an attempt to book this timeslot on this date. Below is the a simplified version of the php script which I wrote to implement the this functionality. <?php function checkSlot() { // Get data $test_date = $_GET["bookingDate"]; // Database connection $conn = mysqli_connect("localhost","root","","wordpress"); if(!$conn) { die('Problem in database connection: ' . mysql_error()); } // Attempt to find Duplicate Primary Keys $query = "SELECT Count(*) AS 'total' FROM Bookings WHERE booking_date ='{$booking_date}' AND booking_slot = '9am'"; $result = mysqli_query($conn, $query) or die(mysqli_error($conn)); $num = $result->fetch_assoc(); If ($num['total'] == 0) { echo "<script> document.getElementById('9amTimeSlotRadioButton').disabled = false; </script>"; } else if($num['total'] > 0) { echo "<script> document.getElementById('9amTimeSlotRadioButton').disabled = true; </script>"; } } ?> My problem is that I cant get the Javascript line within the if statement to execute and disable/enable the related 9am radio button. Upon research into this, I have recently found out that it is not possible to do this with just Php and JavaScript, as php runs serverside and javascript runs client-side and Ajax would be needed here. So, im in a spot of bother now as one of the main selling points of this project was to be able to get this functionality working. I have a massive favour to ask of you guys, could you chime in and guide me on how to implement this functionality by using Ajax? I have zero experience in the language so I really dont know where to start. Any input at all on this topic would be much appreciated. Thanks in advance guys, Dave Ireland.
  19. hello every one.... Can any one plz help me how to detect mobile device brand like samsung, nokia or micromax uisng php or javascript.... Any help will be greatly appreciated.... Thank you.. :)
  20. hello eveyone.. How can i pass values from one page to another using javascript.. I can do it using php but I need in javascript or jquery... suppose take this as an example... <script src="myscript.js?uid=123"></script> if the above step is possible then plz help me out.... IF NOT THEN the second way i want is <script src="myscript.php?uid=123"></script> If the above code doesn't have script tag then i can access the value but tthe <script> tag is making me impossible to do it...... I have used this step to access the value from the above code but it shows nothing... <?php $val = $_GET['uid']; echo $val; ?> Any help will be greatly appreciated... Thank you in advance...
  21. I need a js gallery that automatically loads a main photo and I'm hoping someone can point me in the right direction to find one. Currently I'm using http://www.dynamicdrive.com/dynamicindex4/thumbnail2.htm But my issue is that this code doesn't load a photo until an image is clicked or you hover over it and I want one that loads a chosen photo automatically. (I have a db table with the photos info in it) Thanks for any help or pointers SJ
  22. Hi, I need help getting this thing to work, I'm not sure on how to $_GET[] data after a fragment in the URL. I've seen it used on websites before, for example: example.com/#home?q=test A working example is: http://craftland.org/#map&p=aether This is the code I'm using for the pages: http://pastebin.com/vAHppEyr Any help would be great! Thanks, Kez.
  23. Hi There! I would like to contribute to some free software web project. I have good skills in PHP and frontend Html, CSS3 and JavaScript (jQuery). Could you guide me please? Where can I start from? Thank you very much!
  24. Hey Guys ! i'm not sure if i posted my topic in the right side anyway .. i have a countdown.js file everything is OK , but the big problem is the countdown not working at all ,( Days , Hours ,Min , Sec) all of this keeps in zero but the count UP work normal this is the source code : http://jsfiddle.net/NdfPR/2/ in line 29 and 30 until: new Date(2014, 4 - 1, 4, 0, 0, 0), since: null, nothing happen with this code but if i changed to this until: null, since: new Date(2014, 4 - 1, 4, 0, 0, 0), the count up will work and i don't count up ,, this js file is linked to my template so if there's anything to solve this problem ,, i'm here if i forget anything to
  25. I'm wondering the best way to handle validation messages for blind people, or sight-impaired. In my application, the situation on a save with errors is: User clicks save AJAX call goes to save the record; wait bar appears on the page's status bar Error is returned. The wait bar changes to show "Error on save" Below the status bar, each field name is listed with the appropriate error message. ("Name - Cannot be blank" or whatever) Within the fields themselves, the same message is shown again. (Next to the "Name" label on the page, "cannot be blank" would show up.) This functionality is great for sighted people. But for non-sighted, I'm not sure exactly how to handle it. Should an error become "selected" or something? I mean, it's just a div. I don't really have the answer. I posted this in general HTML but it could frankly be AJAX or JS or something. I think HTML is probably the most correct.
×
×
  • 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.