ScotDiddle
-
Posts
204 -
Joined
-
Last visited
Never
Posts posted by ScotDiddle
-
-
gaggid,
Take a look at this class... It writes, then reads (parses) the content of an XML File.
http://www.phpclasses.org/browse/file/19181.html
Scot L. Diddle, Richmond VA
-
Muddy_Funster,
Yeah, but... Don't discount jQuery... Get it here: http://jquery.com/
Then you can turn off / on async functionallity... on: don't wait, off (false) wait...
Plus, jQuery takes complex tasks and makes them easy...
The following is a sub-set of my own ajax processing scheme...
1.) ajax call:
<script type="text/javascript"> // #DMGPOWNER is the id of the select box var DMGPOWNER = jQuery('#DMGPOWNER option:selected').text(); DMGPOWNER = strtoupper(DMGPOWNER); var ClaimantDriver = AJAXTrafficCop('ClaimantDriverYN', DMGPOWNER); var validAJAXResult = checkAJAXResults(ClaimantDriver); var debug = false; if (debug) { alert('ClaimantDriver Ajax Return: ' + "'" + ClaimantDriver + "'"); } if (validAJAXResult) { var propertyType = document.getElementById('DMGPTYPE').selectedIndex; if (propertyType === 1 || propertyType == 2) { // Vehicle OR Other ClaimantDriver = Boolean(ClaimantDriver); if (ClaimantDriver) { // As determined by ajaxTrafficCop.js / .php // alert('Setting up Claimant Driver'); $("#VehicleInfo").show(); $("#ClaimantVehicleType").show(); $("#InsuredVehicleType").hide(); } // END if (ClaimantDriver) { } // END if (propertyType === 1 || propertyType == 2) { // Vehicle OR Other } // END if (validAJAXResult) { /** * * Make sure PHP ('AJAXTrafficCop.php') * * and * * JavaScript ('AJAXTrafficCop.js') played nice... * */ function checkAJAXResults(valueToCheck) { var returningValueToCheck = valueToCheck; suppliedJSParmsAreInvalid = stristr(returningValueToCheck, 'invalid'); // See around line 89 in // 'AJAXTrafficCop.js' if (suppliedJSParmsAreInvalid) { errorText = returningValueToCheck; alert(errorText); return false; } suppliedPHPParmsAreMissing = stristr(returningValueToCheck, 'missing'); // See around line 104 in // 'AJAXTrafficCop.php' suppliedPHPParmsAreInvalid = stristr(returningValueToCheck, 'invalid'); // See around line 109 in // 'AJAXTrafficCop.php' if ( (suppliedPHPParmsAreMissing) || (suppliedPHPParmsAreInvalid) ) { pieces = explode('|', returningValueToCheck); line1 = pieces[0]; line2 = pieces[1]; errorMessage = line1 + line2; alert(errorMessage); return false; } return true; } // END function checkAJAXResults(valueToCheck) { </script>
2.) AJAXTrafficCop.js
function AJAXTrafficCop(jurisdiction, citation) { if ( typeof(citation) != 'undefined') { var directive = null; } var trafficCop = jurisdiction; var directive = citation; var complexID = stristr(trafficCop, '_'); // Multiple ID's for the same task var debug = false; if (debug) { alert('trafficCop : ' + trafficCop); alert('directive : ' + directive); alert('complexID : ' + complexID); } if (complexID) { // Detective work needed pieces = explode('_', trafficCop); trafficCop = pieces[1]; // 'Complete' // alert('TrafficCop : ' + trafficCop); complexSubject = pieces[0]; // 'BasicInfo' // alert('ComplexSubject : ' + complexSubject); } debug = false; if (debug) { // One... // Or the other : // if ( (debug) || (complexID == 'INSVEHZIP') ) { alert('trafficCop : ' + trafficCop); alert('complexSubject : ' + complexSubject); } var asyncParmBoolean = false; // Do you want the callling JS to wait for the AJAX to complete ? // "asyncParmBoolean = false" means to process the request // asyncronously - ie.: wait for AJAX to complete first... var returnAJAXResult = false; // Do you want to "see" (read use) any output from AJAX ? // Even if you produce output, you may not want to intercept... switch(trafficCop) { case 'ClaimantDriverYN' : // Called From checkTrio() in 'Header' segment of // 'AutoDamgProp.phw' around line 668. var asyncParmBoolean = false; var returnAJAXResult = true; // Directive: 'Property Owners Name'. directive = strtoupper(directive); var dataParm = "ClaimantDriverYN=" + directive; var debug = true; if (debug) { alert(dataParm); } break; default : alert('A switch error occurred in \'AJAXTrafficCop.js\' while trying to process \'' + trafficCop + '\' for: \'' + directive + '\'.\n\n\tOne or more of the expected parm values are invalid.\n\n \n (Or : \'ajaxTrafficCop.php\' has a syntax error which prevented it from processing a valid JS request...) \n \n\tThe data generated for this page cannot be trusted !\n\nPlease report this message to the IT Helpdesk !'); return; break; } $.ajax({ type: "GET", url: "/common/include/ajaxTrafficCop.php", data: dataParm, async: asyncParmBoolean, success: function(msg) { /** * * Handle programmer error... * */ if (stristr(msg, 'ajaxTrafficCop.php')) { alert( msg ); return; } else { // Maybe user wants to see the results of the AJAX Call... var render = returnAJAXResult; // If true, and you get back a null msg, check // trafficCop.php for $display = false or // make sure the item of interest is echo'ing // somthing... if (render) { debug = false; if (debug) { // Change this bad boy to something of interest... if (trafficCop == 'DOMToCheckZipFor') { alert(msg); } } result = msg; } } } // END success: function(msg) { }); // END $.ajax({ if (returnAJAXResult) { if ( typeof(result) != 'undefined') { return result; // Generally used when a JS call to AJAX needs the results of the // call at a later time. ( Also needs 'asyncParmBoolean = false;' ) } else { // We don't return a value, because this message should only be generated // when we were expecting 'AJAXTrafficCop.php' to return some value(s), but didn't. alert('An error occurred in \'AJAXTrafficCop.js\' while trying to process \'' + trafficCop + '\' for: \'' + directive + '\'.\n\n\tThe expected return value was not genrated in \'AJAXTrafficCop.php\'\n\n(Or : there is a syntax error in \'AJAXTrafficCop.php\' which prevented valid JS parms to be processed.)\n\n\tThe generated data on this page cannot be trusted !\n\nPlease report this message to the IT Helpdesk !'); } } // END if (returnAJAXResult) { } // END function AJAXTrafficCop(id, status) {
3.) ajaxTrafficCop.php
<?php // Set no caching header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); header("Cache-Control: no-store, no-cache, must-revalidate"); header("Cache-Control: post-check=0, pre-check=0", false); header("Pragma: no-cache"); set_time_limit(0); session_start(); $debug = false; if ($debug) { error_reporting(E_ALL); ini_set('display_errors', 'on'); } $incomingGetParm = $_GET; $debug = FALSE; if ($debug) { $parm = $incomingGetParm; echo "<pre><h3 style=\"color: red;\"> \n"; var_dump($parm); echo "</pre></h3> \n"; } foreach ($incomingGetParm as $getIDX => $gottenItem) { $switchCriteria = $getIDX; $getParmValue = $gottenItem; } $debug = FALSE; if ($debug) { if ($switchCriteria == 'ownedNonowned') { // Change as needed for debug processing... echo "Debug report from ajaxTrafficCop.php with built-in exit. /* --> \$switchCriteria --> " . $switchCriteria . "<-- :: \$getParmValue --> " . $getParmValue . " <-- */ \n"; exit; } } // echo " !!! \$switchCriteria : $switchCriteria !!! \n"; switch($switchCriteria) { case 'ClaimantDriverYN' : // Called from around line 668 in the "Header" segment of // 'AutoDmgProp.phw' /** * * In AutoDmgProp.php, we have to determine whether or not we are dealing * * with an 'Insured Driver' or a 'Claimant Driver' to decide whether or * * not to allow "Same As Owner's" check-box. * */ $nameToCheck = strtoupper($getParmValue); $claimantDriver = stristr($nameToCheck, 'CLAIMANT DRIVER'); if ($claimantDriver) { echo true; } else { echo false; } break; default : if ( ($switchCriteria == null) || ($switchCriteria == '') || (!isset($switchCriteria)) ) { $switchCriteria = '!! MISSING !!'; $missingCriteria = true; } if ($missingCriteria) { echo " AJAX \$switchCriteria parm (\"$switchCriteria\") missing in program: 'ajaxTrafficCop.php'. \n \n"; } else { echo " AJAX \$switchCriteria parm (\"$switchCriteria\") is invalid in program: 'ajaxTrafficCop.php'. \n \n"; } echo "(Check the parms passed to AJAXTrafficCop JS and the switch setting in same.) \n\n"; echo " Please report this message to the IT Help Desk... "; echo "\n"; break; } // switch($switchCriteria) { ?>
Scot L. Diddle, Richmond VA
-
Ieszer,
Your extra php delimiters are getting in the way. My IDE shows a syntax error... I'm surprised it ran at all...
Try:
$message = include("another.php"); echo $message;
Scot L. Diddle, Richmond VA
-
searls03,
Will this work for you ?
session_start(); // Must start session first thing /* Created By Adam Khoury @ www.flashbuilding.com -----------------------June 20, 2008----------------------- */ // Here we run a login check if (!isset($_SESSION['complete'])) { echo 'Please <a href="/login.php">log in</a> to access your account'; exit(); } else { // Place Session variable 'id' into local variable require_once "connect.php"; $sql = mysql_query("SELECT * FROM cart"); while($row = mysql_fetch_array($sql)){ $cid = $row["cart_id"]; $academy = $row["academy"]; $complete = "".$cid."".$academy.""; $_SESSION['complete'] = $complete; $_SESSION['cart_id'] = $cid; $_SESSION['academy'] = $academy; } } //Connect to the database through our include require_once "connect.php";// Place Session variable 'id' into local variable $academy = $_SESSION['academy']; $sql = mysql_query("SELECT * FROM cart"); while($row = mysql_fetch_array($sql)){ $cid = $row["cart_id"]; $_SESSION['cart_id'] = $cid; } echo $cid; echo "<br />"; echo $academy; ?>
I changed 'include_once' to 'require_once' so the prcess will die if your SQL credentials are not found.
Scot L. Diddle, Richmond VA
-
Bazzaah,
I don't use MySQL, I'm a DB2 guy, but take a look a this link: http://www.tizag.com/mysqlTutorial/mysqlfetcharray.php
(I only used an array because I did not have access to your table, nor did I have the time or inclination to build one in DB2)
Scot L. Diddle, Richmond VA
-
Bazzaah,
Good morning... First off, when you run your script and view source, you get:
<table width="800px" class="center" border="1"><td><tr><td><a href="word.php?w="></a></td><td><a href="word.php?w="></a></td><td><a href="word.php?w="></a></td></tr><tr><td><a href="word.php?w="></a></td><td><a href="word.php?w="></a></td><td><a href="word.php?w="></a></td></tr><tr><td><a href="word.php?w="></a></td><td><a href="word.php?w="></a></td><td><a href="word.php?w="></a></td></tr><tr><td><a href="word.php?w="></a></td><td> </td><td> </td></tr></table>
Kind of hard to debug...
Adding some Source control new line characters , we get:
<table width="800px" class="center" border="1"> <td><tr> <td><a href="word.php?w="></a></td> <td><a href="word.php?w="></a></td> <td><a href="word.php?w="></a></td> </tr> <tr> <td><a href="word.php?w="></a></td> <td><a href="word.php?w="></a></td> <td><a href="word.php?w="></a></td> </tr> <tr> <td><a href="word.php?w="></a></td> <td><a href="word.php?w="></a></td> <td><a href="word.php?w="></a></td> </tr> <tr> <td><a href="word.php?w="></a></td> <td> </td> <td> </td> </tr> </table>
Right away, we can now see that we have a leading <td> which should not be there.
Here is the result of my altered script:
<table width="800px" class="center" border="1"> <tr> <td><a href="word.php?w=1">1</a></td> <td><a href="word.php?w=2">2</a></td> <td><a href="word.php?w=3">3</a></td> </tr> <tr> <td><a href="word.php?w=4">4</a></td> <td><a href="word.php?w=5">5</a></td> <td><a href="word.php?w=6">6</a></td> </tr> <tr> <td><a href="word.php?w=7">7</a></td> <td><a href="word.php?w=8">8</a></td> <td><a href="word.php?w=9">9</a></td> </tr> <tr> <td><a href="word.php?w=10">10</a></td> <td> </td> <td> </td> </tr> </table>
A note about the new line character ( and tab character ), they don't work hidden behind '', only if imbedded in : "".
You code has a mix of single quotes and double quotes for holding your string content... for any html you want to parrot out, always use double quotes and the new line character...
Here is my altered code:
<?php // Program Name: test.php // Program Title: // Created by: // Template family: // Template name: // Purpose: // Program Modifications: // Set no caching header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); header("Cache-Control: no-store, no-cache, must-revalidate"); header("Cache-Control: post-check=0, pre-check=0", false); header("Pragma: no-cache"); set_time_limit(0); session_start(); echo '<table width="800px" class="center" border="1">' . "\n"; $i = 0; $max_columns = 3; $myArray = array(1,2,3,4,5,6,7,8,9,10); // while ($list = mysql_fetch_array($result)) { while (!empty($myArray)) { // make the variables easy to deal with $list['word'] = array_shift($myArray); // open row if counter is zero if($i == 0) echo "<tr> \n"; /** * * * Bad coding technique ( Works, just hard do follow... ( your indent is wrong. ) ) * * Better to always use: * * if ($someVar = $someVal) { * doSomething(); * } * * even for one-line directive for true "if" * * */ echo '<td><a href="word.php?w=' . $list['word'] . '">' . $list['word'] . "</a></td> \n "; // increment counter - if counter = max columns, reset counter and close row if(++$i == $max_columns) { echo "</tr> \n"; $i=0; } // END if(++$i == $max_columns) { } // END while (!empty($myArray)) { // } END while ($list = mysql_fetch_array($result)) { // clean up table - makes your code valid! if($i < $max_columns) { for($j=$i; $j<$max_columns;$j++) echo "<td> </td> \n"; /** * * * Bad coding technique ( Works, just hard do follow... ) * * Better to always use: * * for($j=$i; $j<$max_columns;$j++) { * doSomething(); * } * * even for one-line directive for true "for" * * */ } // END if($i < $max_columns) { echo '</tr>' . "\n"; echo '</table>' . "\n"; ?>
-
johnny_v,
If you don't store the user-supplied credentials (user name / PW) in a DB (like MySQL or DB2 or some such) then why have them enter it.
Session variables:
$_SESSION['UserID'] = $POST['userid']
and
$_SESSION['Password'] = $_POST['password']
don't do you much good for subsequent visits by the same user on some other date... $_SESSION var are only good until the user closes his browser.
You should ask for User Name and PW, AND write them to your DB Users_table (make up your own name here...) Then, on later visits, when the user logs in again, query the DB to see whether or not he has registered before... If he has, extract the variables from the DB and assign the DB Row values to
$_SESSION['UserID'] = $sqlResult['userid']
and
$_SESSION['Password'] = $sqlResult[password]
.
If he is a new user, store the info in the DB.
Scot L. Diddle, Richmond VA
-
Pikachu2000,
Thanks for the suggestion, howerver that was not the issue.
I found the solution here: http://stackoverflow.com/questions/4898752/css-style-differs-in-localhost-vs-machine-name
"I too had the same issue. This is due to the compatibility issue in ie8. go to tools->compatibility View Settings uncheck "Display intranet sites in Compatibility view."
Ya gotta love Google.
Scot L. Diddle, Richmond VA
-
Hi Folks,
When I get index.php with 10.x.x.x, the CSS behaves correctly. If I pull up the same page using an internal domain name Vis.: 'somename.somecompany.com'. the CSS is skewed.
Any ideas what might cause this... ( by "skewed" I mean the font is bigger and superfluous space appears between the Tabs at the top and Tab content.
Any help will be appricated.
Thanks ,
Scot L. Diddle, Richmond VA
-
Lisa23,
I tested on IE 8 and all seems fine here also.
Scot L. Diddle, Richmond VA
-
esoteric,
What is failing ?
Did you try something like this:
On the logon page, : $_SESSION['who'] = $_POST['who'];
$_SESSION['ID'] = $_POST['ID'];
Then, later, to store values in a DB:
$who = $_SESSION['who'];
$ID = $_SESSION['ID'];
ScotL. Diddle, Richmond VA
-
drayarms,
You could try something similar to the following...
Scot L. Diddle, Richmond VA
<?php /** * * Simulate multiple SQL queries * */ $array1 = array('red', 'white', 'blue'); $array2 = array('yellow', 'orange', 'purple'); $array3 = array('pink', 'plum', 'violet'); $array = array($array1, $array2, $array3); foreach ($array as $arrayOfColors) { // Simulate SQL Query results $stringOut = ''; foreach ($arrayOfColors as $colors) { $stringOut .= "'" . $colors . "', "; } $strLength = strlen($stringOut); $last = $strLength - 2; $cols = substr($stringOut,0, $last); echo $cols . '<br />'; } /** * * Output: * */ // 'red', 'white', 'blue' // 'yellow', 'orange', 'purple' // 'pink', 'plum', 'violet' ?>
-
infrabyte,
Your $_GET parm is empty because you are submitting your form with post method.
If you "got" your mobile parm from another page with method="GET" you can save the variable for later use by learning and implementing $_SESSION variables.
( In a nut shell, at the top of each script enter: session_start(); Then, once your $_GET['mobile'] parm is set to $mobile, do: $_SESSION['mobile'] = $mobile;
Later when you want this value on another page, start the page with session_start(); then code: $mobile = $_SESSION['mobile'] and you should be good to go. )
Scot L. Diddle, Richmond VA
-
hoponhiggo,
This is a perfect example of where AJAX will come in handy. I recommend the JQuery AJAX interface (http://api.jquery.com/jQuery.ajax/)
Scot L. Diddle, Richmond VA
-
unemployment,
Try this:
if isset($_GET) { $incomingGetParm = $_GET; $debug = FALSE; if ($debug) { $parm = $incomingGetParm; echo "<pre><h3 style=\"color: #205E75;\">\ $incomingGetParm \n"; var_dump($parm); echo "</pre></h3> \n"; } foreach ($incomingGetParm as $getIDX => $gottenItem) { $getID = $getIDX; // This is the part before the equal sign $getParmValue = $gottenItem; // This is the part after the equal sign } }
Scot L. Diddle, Richmond VA
-
Hello All,
I have developed a new system for an insurance company. One of the requirements is to generate an email file which is a copy of all of the user input. The HTML file is saved to an I Series file, then emailed to the recipients as an attachemnt. Email clients like Outlook open the file and it displays just fine. However, if a recipients forwards ( or sends ) the attached file to their Blackberry, the input lables render correctly, but all of the data in the input, select, check-box, radio buttons, text areas, etc., are blank. All fields in the email file are disabled, to prevent changes "after the fact"... Does anyone know why this is occruing, how to prevent said problem, or perhaps a link that can help me out ?
Thanks in Advance,
Scot L. Diddle, Richmond VA
-
Hi Folks,
I've been unemployed for a couple of months. New position requires some code testing on production. Boss doesn't want to enable remote debugging on prod because he says in the past, it produced a bunch of unwanted error messages. I can fix that issue with error_reporting, but he says we can only install zenddebugger.so in prod if it has an on/off switch. I have hit Google and php.net pretty hard today looking for an ini_set() parameter to toggle this bad boy.
Is this possible? Any pointers to web site/page which discusses this issue will be appreciated.
Thanks in advance,
Scot L. Diddle, Richmond VA
-
help_lucky,
My Bad !... You have to have radio button groups all have the same name
In my posted code, change:
<input type="radio" name="taxRadio" value="return" onclick="setServiceType(this.value);" /> Tax return
<input type="radio" name="auditRadio" value="audit" onclick="setServiceType(this.value);" /> Audit
To:
<input type="radio" name="Radio" value="tax" onclick="setServiceType(this.value);" /> Tax return
<input type="radio" name="Radio" value="audit" onclick="setServiceType(this.value);" /> Audit
Then, the first row of our output display will be:
Name of Submitted element: Radio
tax
Which tells us that the tax radio button was selected.
Sorry for the confusion.
Scot L. Diddle, Richmond VA
-
help_lucky,
Below is a modified version of your code. ( I gave unique names to Tax and Audit... ( they used to both be: "service" )
Here is the output:
Name of Submitted element: taxRadio
return
Name of Submitted element: name
a
Name of Submitted element: phone
b
Name of Submitted element: email
c
Name of Submitted element: tax_year
d
Name of Submitted element: state
e
Name of Submitted element: newhome
on
Name of Submitted element: Audit_year
12/31
Name of Submitted element: Type_of_Business
Name of Submitted element: submitForm
Submit
The value you are looking for is: "taxRadio Return "; this is the name and value of the radio button the user selected.
Hope this helps.
test.php is shown below.
Scot L. Diddle, Richmond VA
<?php Header("Cache-control: private, no-cache"); Header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); Header("Pragma: no-cache"); if (isset($_POST) && $_POST != NULL) { echo "<table border=\"0\"> \n"; echo "<tr> \n"; foreach ($_POST as $IDX => $submittedValues) { $$IDX = $submittedValues; echo "<td> \n"; echo "Name of Submitted element: <strong>$IDX</strong> "; echo "</td>"; echo "<td> \n"; echo "<pre> \n"; print_r($$IDX); echo "</pre> \n"; echo "</td></tr> \n"; } echo "</table> \n"; exit; } ?> <html> <head> <script type="text/javascript"> function setServiceType(typeStr){ document.getElementById('return_info').style.display = (typeStr=='return') ? 'inline' : 'none'; document.getElementById('audit_info').style.display = (typeStr=='audit') ? 'inline' : 'none'; } </script> </head> <body> <form name="myForm" id="myForm" method="POST" action="test.php"> <b>Type of service:</b><br /> <input type="radio" name="taxRadio" value="return" onclick="setServiceType(this.value);" /> Tax return <input type="radio" name="auditRadio" value="audit" onclick="setServiceType(this.value);" /> Audit <br /><br /> <b>Contact Info</b> <br /> Name: <input type="text" name="name" /><br />Phone: <input type="text" name="phone" /> <br /> Email: <input type="text" name="email" /> <br /><br /> <div id="return_info" style="display:none;"> <b>Please provide the following info for the return service requested: </b> <br /> Tax Year: <input type="text" name="tax_year" value="2009" /><br /> State: <input type="text" name="state" /> <br /> <input type="checkbox" name="newhome" /> Check here if you are a new home buyer. </div> <div id="audit_info" style="display:none;"> <b>Please provide the following info for the audit service requested:</b> <br /> Fiscal Year end date (mm/dd): <input type="text" name="Audit_year" value="12/31" /> <br /> Type of business: <input type="text" name="Type of Business" /> <br /> </div> <input type="submit" id="submitForm" name="submitForm" value="Submit"> </body> </html>
-
liamloveslearning,
See if the following does what you want.
Let us know.
<?php Header("Cache-control: private, no-cache"); Header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); Header("Pragma: no-cache"); ?> <html> <head> <script type="text/javascript"> function addText() { if (document.form1.menu.options[document.form1.menu.selectedIndex].value != '#') { // Don't write "Quick Links" to text area... // Magic Happens with the "+=" operator document.form1.accept.value += document.form1.menu.options[document.form1.menu.selectedIndex].value + "\n"; alert(document.form1.accept.value); // document.form1.textarea.accept.value=document.form1.menu.options[document.form1.menu.selectedIndex].value; } } </script> </head> <body> <form name="form1"> <select onChange="addText();" style="background-color: transparent; font-size: 10px; color: rgb(0, 102, 153); font-family: verdana;"name="menu"> <option id="val[]" name="val[]" value="#">Quick Links ...</option> <option id="val[]" name="val[]" value="This is for value no.1">Value No. 1</option> <option id="val[]" name="val[]" value="This is for value no.2">Value No. 2</option> <option id="val[]" name="val[]" value="This is for value no.3">Value No. 3</option> <option id="val[]" name="val[]" value="This is for value no.4">Value No. 4</option> <option id="val[]" name="val[]" value="This is for value no.5">Value No. 5</option> <option id="val[]" name="val[]" value="This is for value no.6">Value No. 6</option> </select> <span width="50px;"> Text -> </span> <textarea type="text" id="accept" name="accept" style="width:275px; height:175px;"></textarea> <br/> </form> </body> </html>
Hope it helps.
Scot L. Diddle, Richmond VA
-
aebstract,
http://www.dynamicdrive.com/dynamicindex1/chainedmenu/index.htm
may be just the ticket.
Scot L. Diddle, Richmond VA
-
tqla,
Here's a way to do it programatically:
<?php Header("Cache-control: private, no-cache"); Header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); Header("Pragma: no-cache"); $appointment = array( 7 => array( 'id' => 7, 'session_id' => 3, 'provider_id' => 96, 'customer_id' => 95, 'location_id' => 1, 'seats' => 1, 'created_at' => 1274891117, 'starts_at' => 1275066000, 'duration' => 900, 'lead_in' => 900, 'lead_out' => 900, 'approved' => 1, 'no_show' => 0, 'is_ghost' => 0, 'service_id' => 2, '_invoice' => 7, ), 8 => array( 'id' => 8, 'session_id' => 4, 'provider_id' => 97, 'customer_id' => 96, 'location_id' => 2, 'seats' => 2, 'created_at' => 1274891118, 'starts_at' => 1275066001, 'duration' => 901, 'lead_in' => 901, 'lead_out' => 901, 'approved' => 2, 'no_show' => 1, 'is_ghost' => 1, 'service_id' => 3, '_invoice' => 8, ) ); $display = FALSE; if ($display) { require_once($toodles . 'includes/debugFunctions.php'); echo "</script> \n"; printArray($appointment, '$appointment', __FILE__, __LINE__); /** * * Returns: * */ // Name :: $appointment :: Reporting from line :: 36 :: in program :: /var/www/html/VAT_DEV/test.php :: // // Array // ( // [7] => Array // ( // [id] => 7 // [session_id] => 3 // [provider_id] => 96 // [customer_id] => 95 // [location_id] => 1 // [seats] => 1 // [created_at] => 1274891117 // [starts_at] => 1275066000 // [duration] => 900 // [lead_in] => 900 // [lead_out] => 900 // [approved] => 1 // [no_show] => 0 // [is_ghost] => 0 // [service_id] => 2 // [_invoice] => 7 // ) // // [8] => Array // ( // [id] => 8 // [session_id] => 4 // [provider_id] => 97 // [customer_id] => 96 // [location_id] => 2 // [seats] => 2 // [created_at] => 1274891118 // [starts_at] => 1275066001 // [duration] => 901 // [lead_in] => 901 // [lead_out] => 901 // [approved] => 2 // [no_show] => 1 // [is_ghost] => 1 // [service_id] => 3 // [_invoice] => 8 // ) // // ) // } foreach($appointment as $IDX => $customerArray) { $display = FALSE; if ($display) { require_once($toodles . 'includes/debugFunctions.php'); echo "</script> \n"; printArray($customerArray, '$customerArray', __FILE__, __LINE__); /** * * Returns: * */ // Name :: $customerArray :: Reporting from line :: 104 :: in program :: /var/www/html/VAT_DEV/test.php :: // // // Array // ( // [id] => 7 // [session_id] => 3 // [provider_id] => 96 // [customer_id] => 95 // [location_id] => 1 // [seats] => 1 // [created_at] => 1274891117 // [starts_at] => 1275066000 // [duration] => 900 // [lead_in] => 900 // [lead_out] => 900 // [approved] => 1 // [no_show] => 0 // [is_ghost] => 0 // [service_id] => 2 // [_invoice] => 7 // ) // // Name :: $customerArray :: Reporting from line :: 104 :: in program :: /var/www/html/VAT_DEV/test.php :: // // // Array // ( // [id] => 8 // [session_id] => 4 // [provider_id] => 97 // [customer_id] => 96 // [location_id] => 2 // [seats] => 2 // [created_at] => 1274891118 // [starts_at] => 1275066001 // [duration] => 901 // [lead_in] => 901 // [lead_out] => 901 // [approved] => 2 // [no_show] => 1 // [is_ghost] => 1 // [service_id] => 3 // [_invoice] => 8 // ) } foreach ($customerArray as $customerIDX => $currentCustomer) { if ($customerIDX == 'customer_id') { echo "customer_id: " . $customerArray[$customerIDX] . " found for \$appointment[$IDX] <br /><br/> \n"; } } } ?>
Scot L. Diddle, Richmond VA
-
pornophobic,
Whereas I understand the difference between require and include, if your script dosen't "NEED" the inclcuded script to operate correctly, then include is fine. If the included file is absolutely required for your script to run correctly, use require.
If you are including a script which have classes or functions, require_once and include_once insures that if the fucntions or classes in the included script are already available, then don't include/require them again... If they are included again, you will get a fatal error stating that the functions / classes in your newly inserted script already exitst, and cannot be re-defined.
I do not know of the performance difference between the two types ( include/include_once, require/require_once ).
Hope this helps.
Scot L. Diddle, Richmond VA
-
calmchess,
PHP has a built in function to do this: key_exists('key_to_find', $inThisArray)
See code below.
Scot L. Diddle, Richmond VA
<?php Header("Cache-control: private, no-cache"); Header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); Header("Pragma: no-cache"); $someArray = array(1 => 'onesValue', 2 => 'twosValue', 4 => 'foursValue' ); // Echos Line 2 if(key_exists('3', $someArray)){ echo "Line 1: Value for key = '3' exists and his value is " . $someArray3 . "<br /><br/> \n"; } else{ echo "Line 2: Value for key = '3' does not exist" . "<br /><br/> \n"; } // Echos Line 1 if(key_exists('4', $someArray)){ echo "Line : Value for key = '4' exists and his value is '" . $someArray[4] . "'<br /><br/> \n"; } else{ echo "Line 1: Value for key = '4' does not exist" . "<br /><br/> \n"; } ?>
php interact with javascript
in Javascript Help
Posted
marcus_epik,
I would use jQuery AJAX, but here is a "Quick and Dirty" that should work...
Scot L. Diddle, Richmond VA
Where : transferJSParamToPHP.php
looks like this...