Jump to content

Search the Community

Showing results for tags 'jscript'.

  • 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

Found 6 results

  1. Hello everyone, I am working on a form that is similar to a shopping cart system and I am thinking of creating a button that submits the checked value and saves them to a $_SESSION variable. And also a link that links to a cart.html that takes the values of a $_SESSION variable. I am have trouble figuring what tag/attribute should I use in order to achieve that. Right now my code attached below submits the checked values to cart.html directly. However I want my submit button to save the checked box to a $_SESSION variable and STAY on the same page. And then I will implement a <a> to link to the cart.php. I researched a little bit about this subject and I know it's somewhat related to ajax/jquery. I just wanted to know more about it from you guys. I appreciate your attention for reading the post and Thanks! Below is the form that I currently have: <form name= "finalForm" method="POST" action="cart.php"> <input type="Submit" name="finalSelected"/> <?php foreach($FinalName as $key => $item) {?> <tr> <td><input type="checkbox" name="fSelected[]" value="<?php echo htmlspecialchars($FinalID[$key])?>" /> <?php echo "$FinalID[$key] & $item";?> </td> </tr> <?php } ;?> Below is the code for cart.php <?php require ('connect_db.php'); if(isset($_POST['finalSelected'])) { if(!empty($_POST['fSelected'])) { $chosen = $_POST['fSelected']; foreach ($chosen as $item) echo "aID selected: $item </br>"; $delimit = implode(", ", $chosen); print_r($delimit); } } if(isset($delimit)) { $cartSQL = "SELECT * from article where aID in ($delimit)"; $cartQuery = mysqli_query($dbc, $cartSQL) or die (mysqli_error($dbc)); while($row = mysqli_fetch_array($cartQuery, MYSQLI_BOTH)) { $aTitle[] = $row[ 'name' ]; } } ?> <table> <?php if(isset($delimit)) { $c=0; foreach($aTitle as $item) {?> <tr> <td> <?php echo $aTitle[$c]; $c++;?> </td> </tr> <?php }}?> </table>
  2. Hi could anyone help me please. I have this code and tried to do event calendar and retrieve the event data from mysql phpMyAdmin. My problem is current year doesnt display all data from database on the calendar. example i've manually add data from January until May for current year (2014) but it only display the data for May only. it seems that other data is not been display properly. another problem is that im stuck with, example when im in current month (example May) all data is display but when i've click the navigation link to go to the previous month and when i go back to current month (May) the event that has been mark on the calendar is missing. PLEASE i need this to be done this week or else im dead! //config.php <?php /* Define MySQL connection details and database table name */ $SETTINGS["hostname"]='localhost'; $SETTINGS["mysql_user"]='root'; $SETTINGS["mysql_pass"]=''; $SETTINGS["mysql_database"]='talentlo'; $SETTINGS["data_table"]='event_calendar'; /* Connect to MySQL */ if (!isset($install) or $install != '1') { $connection = mysql_connect($SETTINGS["hostname"], $SETTINGS["mysql_user"], $SETTINGS["mysql_pass"]) or die ('Unable to connect to MySQL server.<br ><br >Please make sure your MySQL login details are correct.'); $db = mysql_select_db($SETTINGS["mysql_database"], $connection) or die ('request "Unable to select database."'); }; ?> //calendar.php <?php error_reporting(0); include("config.php"); /// get current month and year and store them in $cMonth and $cYear variables (intval($_REQUEST["month"])>0) ? $cMonth = intval($_REQUEST["month"]) : $cMonth = date("m"); (intval($_REQUEST["year"])>0) ? $cYear = intval($_REQUEST["year"]) : $cYear = date("Y"); // generate an array with all dates with events $sql = "SELECT * FROM ".$SETTINGS["data_table"]." WHERE `event_date` LIKE '".$cYear."-".$cMonth."-%'"; $sql_result = mysql_query ($sql, $connection ) or die ('request "Could not execute SQL query" '.$sql); while ($row = mysql_fetch_assoc($sql_result)) { $events[$row["event_date"]]["title"] = $row["title"]; $events[$row["event_date"]]["description"] = $row["description"]; $events[$row["event_date"]]["venue"] = $row["venue"]; $events[$row["event_date"]]["time"] = $row["time"]; $events[$row["event_date"]]["date"] = $row["event_date"]; } // calculate next and prev month and year used for next / prev month navigation links and store them in respective variables $prev_year = $cYear; $next_year = $cYear; $prev_month = intval($cMonth)-1; $next_month = intval($cMonth)+1; // if current month is December or January month navigation links have to be updated to point to next / prev years if ($cMonth == 12 ) { $next_month = 1; $next_year = $cYear + 1; } elseif ($cMonth == 1 ) { $prev_month = 12; $prev_year = $cYear - 1; } if ($prev_month<10) $prev_month = '0'.$prev_month; if ($next_month<10) $next_month = '0'.$next_month; ?> <table width="100%"> <tr> <td class="mNav"><a href="javascript:LoadMonth('<?php echo $prev_month; ?>', '<?php echo $prev_year; ?>')"><<</a></td> <td colspan="5" class="cMonth"><?php echo date("F, Y",strtotime($cYear."-".$cMonth."-01")); ?></td> <td class="mNav"><a href="javascript:LoadMonth('<?php echo $next_month; ?>', '<?php echo $next_year; ?>')">>></a></td> </tr> <tr> <td class="wDays">Monday</td> <td class="wDays">Tuesday</td> <td class="wDays">Wednesday</td> <td class="wDays">Thursday</td> <td class="wDays">Friday</td> <td class="wDays">Saturday</td> <td class="wDays">Sunday</td> </tr> <?php $first_day_timestamp = mktime(0,0,0,$cMonth,1,$cYear); // time stamp for first day of the month used to calculate $maxday = date("t",$first_day_timestamp); // number of days in current month $thismonth = getdate($first_day_timestamp); // find out which day of the week the first date of the month is $startday = $thismonth['wday'] - 1; // 0 is for Sunday and as we want week to start on Mon we subtract 1 for ($i=0; $i<($maxday+$startday); $i++) { if (($i % 7) == 0 ) echo "<tr>"; if ($i < $startday) { echo "<td> </td>"; continue; }; $current_day = $i - $startday + 1; if ($current_day<10) $current_day = '0'.$current_day; // set css class name based on number of events for that day if ($events[$cYear."-".$cMonth."-".$current_day]<>'') { $css='withevent'; $click = "onclick=\"LoadEvents('".$cYear."-".$cMonth."-".$current_day."')\""; } else { $css='noevent'; $click = ''; } echo "<td class='".$css."'".$click.">". $current_day . "</td>"; if (($i % 7) == 6 ) echo "</tr>"; } ?> </table> //events.php <?php error_reporting(0); include("config.php"); $sql = "SELECT * FROM ".$SETTINGS["data_table"]." WHERE `event_date` = '".mysql_real_escape_string($_REQUEST["date"])."'"; $sql_result = mysql_query ($sql, $connection ) or die ('request "Could not execute SQL query" '.$sql); while ($row = mysql_fetch_assoc($sql_result)) { echo "<h2>".stripcslashes($row["title"])."</h2>"; // echo "<span>".stripcslashes($row["description"])."</span>"; echo "<span>".stripcslashes($row["venue"])."</span>"; echo "<br />"; echo "<span>".stripcslashes($row["time"])."</span>"; } ?> //index.html <!DOCTYPE html> <html lang="en"> <!-- MEGAFOLIO LIGHTBOX FILES --> <link href="css/calendar.css" rel="stylesheet" type="text/css" /> <head> </head> <body> <div id="Calendar" > </div> <div id="Events" > </div> <script language="javascript" src="js/calendar.js"></script> </body> </html> //calendar.js var bustcachevar=1; //bust potential caching of external pages after initial request? (1=yes, 0=no) var bustcacheparameter=""; function createRequestObject(){ try { xmlhttp = window.XMLHttpRequest ? new XMLHttpRequest() : new ActiveXObject("Microsoft.XMLHTTP"); } catch(e) { alert('Sorry, but your browser doesn\'t support XMLHttpRequest.'); }; return xmlhttp; }; function ajaxpage(url, containerid){ var page_request = createRequestObject(); if (bustcachevar) bustcacheparameter=(url.indexOf("?")!=-1)? "&"+new Date().getTime() : "?"+new Date().getTime() page_request.open('GET', url+bustcacheparameter, true) page_request.send(null) page_request.onreadystatechange=function(){ loadpage(page_request, containerid) } } function loadpage(page_request, containerid){ if (page_request.readyState == 4 && (page_request.status==200 || window.location.href.indexOf("http")==-1)) { document.getElementById(containerid).innerHTML=page_request.responseText; }; } function LoadMonth(month, year) { ajaxpage("calendar.php?month="+month+"&year="+year, "Calendar") } function LoadEvents(date) { ajaxpage("events.php?date="+date, "Events") } LoadMonth();calendar.css
  3. I have a series of three listboxes. The first one is working, however the next two refuse to update after clicking on the first one! My table structure is as follows. tblRestaurants RestID, RestName, RestStatus tblLocations RestID, LocationID, CityID, AreaID tblCities CityID, CityName tblAreas AreaID, AreaName The first listbox gives the restaurants, the second the given city(s) that they are in, and third the Area(s) of the city they are in. Here is the main page..... index.PHP <?php try { $objDb = new PDO('mysql:host=MyHead.db.5513143.hostedresource.com;dbname=MyHead', 'MyHead', 'MenuHead@1234'); $objDb->exec('SET CHARACTER SET utf8'); $sql = "SELECT * FROM `tblRestaurants` WHERE `RestStatus` = 'YES' ORDER BY 'RestName'"; $statement = $objDb->query($sql); $list = $statement->fetchAll(PDO::FETCH_ASSOC); } catch(PDOException $e) { echo 'There was a problem'; }<p>?> <!DOCTYPE HTML> <html lang="en"> <head> <meta charset="utf-8" /> <title>Dependable dropdown menu</title> <meta name="description" content="Dependable dropdown menu" /> <meta name="keywords" content="Dependable dropdown menu" /> <link href="/BigStuff/css/core.css" rel="stylesheet" type="text/css" /> <!--[if lt IE 9]> <script src="
  4. I have a phpmyadmin database named FLOW. I have a table in that database named NAMES. I have a form that has the below code in it: <td><b>Assign To:</b> <br><input type="text" name="name" size="15" maxlength="30" value="" /><br /> </td> My question is, how would I edit this code to pull the data from the table listed above for the value?
  5. I have some php code that supervisors use to assign work to employees. I've added a field named clerks. There are 10 clerk names in the phpmyadmin database..clerk1, clerk2, clerk3, and so on to clerk10. I need for the clerk names to be automatically added to the clerk field in the form when it is opened..for instance, if the form is opened clerk1 is automatically inserted. And the next time it is opened, clerk2 is inserted until it reaches clerk10 & then starts over by inserting clerk1....is this possible?Like I said, I have a table in the database named clerk_names & the clerk's name is listed in this table. The database name is named flow. Any help will be greatly appreciated. Thanks
  6. I am having an issue getting the values checked in the check-box. I have tried to clean up the code. I can get the all the selected check-boxes selected (but not per row) or i can get the check-box id per row but not the selected value. I am pretty sure I can transfer the values to the another page but do not know how to get them. Any assistance here would greatly be appreciated! //php variables used $pages = 2 $size = 4 < form id="form" name="cb"> < div style=" width:800px; height:500px; overflow:auto"> < h2>Select Editions</h2> < table id='table' name='table' border=1 cellpadding=7 width=50% height=50% align='center'>\n for($x = 1; $x <= $pages; $x++) : print "<td id='page_$x' class='page_button' align='center' custom='0' >Page $x - "; for($i = 1; $i <= $size; $i++) : print "<input type='checkbox' class='ebutton' id='etype_$x' name='checks[]' value='$i' /> $i"; endfor; </td> </tr> endfor; with this as the Javascript $(document).ready(function() { $(".ebutton").change(function() { var idp = $(this).attr("id").split("_"); var page_num = idp[1]; // I need to find out how to get the checkboxes that are checked per row. Ex: 01,02 //var editions = ?; //alert(editions); var hidden_id = "#etype_page_" + page_num; if($(hidden_id).length < 1) { $("#base").append('<input type="hidden" id="etype_page_'+ page_num +'" name="'+ page_num +'" value="'+ editions +'" class="hidden_edtype" custom="' + editions +'">'); } else { $(hidden_id).val($(this).val()); } update_eShow(); }); }); function update_eShow() { $("#eShow").html(''); $(".hidden_edtype").each(function() { var page = $(this).attr("name"); var value = $(this).attr("custom"); $("#eShow").append('page:' + page + ' values:' + value +'<br>'); }); } page looks like this: | Page 1 - []1 []2 []3 []4 | | Page 2 - []1 []2 []3 []4 | Here is what I have been able to get, but its not right: I select both 01 and 02 for page 1 and only 01 for page 2. My results are: Page:1 Values: 01 Page:2 Values: 01,02,01
  • 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.