Jump to content

Search the Community

Showing results for tags 'javascrip'.

  • 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

Found 3 results

  1. I am retrieving data via Ajax into Choices.js select options My scenario is when I select date, getting the available restaurant tables The retrieving data is 100% working, but it reflects in the select options only in the first request, then when I try to reselect another date I receive the below console error, and choices still keep the initial retrieved data choices.min.js:11 Trying to initialise Choices on element already initialised Choices setValue Function var el = document.getElementsByClassName("table_number")[0]; if (el) { function setChoices(values) { const tableNumbers = new Choices(el, { removeItemButton: true, }).setValue(values); } setChoices(values); } Ajax Code let shiftDate = document.getElementById('reservation_shift_date'); shiftDate.addEventListener("change", function(){ let request = new XMLHttpRequest(); request.open("POST","get_tables.php",true); request.setRequestHeader("content-type","application/x-www-form-urlencoded"); request.onreadystatechange = function(){ if(request.readyState == 4 && request.status == 200){ setChoices(JSON.parse(request.responseText)); } } request.send("date="+shiftDate.value); }); get_tables.php if($_SERVER["REQUEST_METHOD"] === "POST" && isset($_POST['date'])){ $stmt = $conn->prepare("SELECT table_id FROM reservation WHERE shift_date = ?"); $stmt->execute([$_POST['date']]); $rows = $stmt->fetchAll(PDO::FETCH_ASSOC); foreach($rows as $row){ $reserved_tables_id[] = $row['table_id']; } $in = implode(',',$reserved_tables_id); $execute_query = mysqli_query($dbConnection,"SELECT id, table_name FROM tables WHERE id NOT IN ($in)"); while($row = mysqli_fetch_assoc($execute_query)){ $tbl_id = $row['id']; $tbl_name = $row['table_name']; $arr[] = ["value"=>$tbl_id,"label"=>$tbl_name]; } echo json_encode($arr); }
  2. Hi guys, I am trying to display tour information in fullcalendar but nothing is happening and no errors. Here is the php code from fetch-tours.php <?php require_once "config.php"; $json = array(); $sqlQuery = "SELECT * FROM jobs ORDER BY id"; $result = mysqli_query($con, $sqlQuery); $eventArray = array(); while ($row = mysqli_fetch_assoc($result)) { $title = isset($row['name']); $start = isset($row['dep_date']); $end = isset($row['ret_date']); $eventsArray['title'] = $title; $eventsArray['start'] = $start; $eventsArray['end'] = $end; array_push($eventArray, $row); } mysqli_free_result($result); mysqli_close($con); echo json_encode($eventArray); ?> And here is the Javascript that displays the calendar: <script type="text/javascript"> $(document).ready(function() { var date = new Date(); var d = date.getDate(); var m = date.getMonth(); var y = date.getFullYear(); $('#calendar').fullCalendar( { header: { left: 'prev,next today', center: 'title', right: 'month,basicWeek,basicDay' }, editable :true, events: "includes/fetch-tours.php", }); }) </script> The calendar displays fine but just no data. Any help is greatly appreciated. Cheers, Dan
  3. Hi, I'm trying to get my first lines in PHP. I have read some tutorials, but since I'm not a programer is a little hard for me to get it straight. Could someone help me out to put the following javascript into php so I could just call php from my HTML, something like MySelect and get the selector. <h3><font color="#3EA99F">Categories</font></h3> <select id="mySelect" onchange="if(this.options[this.selectedIndex].value != ''){window.top.location.href=this.options[this.selectedIndex].value}"> <option>Select an option</option> <option value="site1">Orange</option> <option value="site2">Pineapple</option> <option value="site3">Banana</option> </select> Thank you so much More Explanation: I want to have something like MyFile.php where I have definied the Selector, so I can call MySelect from Index.html and write the select in the html, so If I have 400 .html pages, I do not have to change the code in the 400 pages if I want to add a value or make any change, but just made the change in MyFile.php.
×
×
  • 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.