627 Posted Topics
Re: try: [CODE=php] function toArray($str, $delimiter=',', $assoc=false) { $data=explode($delimiter,$str); if(TRUE===$assoc) { $temp=array(); $i=-1; $limit=count($data); while(++$i < $limit) { $key=$data[$i]; $val=$data[++$i]; $temp[ $key ]=$val; } unset($data); $data=$temp; } return $data; } $str="category_name:-abs43;c1-abs43;types:-abs43;t1"; $result=toArray($str,'-abs43;',TRUE); print_r($result); [/CODE] | |
Re: I see this multiple times: [CODE]echo "<option value=$row[id]>$row[contam]</option>";[/CODE] However, NONE of your SELECT statements are "asking" for the column `id`, so $row[id] is empty and you would NOT see a value for your elements when the form is posted. If your table does have an `id` column, be sure to … | |
Re: [CODE] <textarea name='content' style='font-size:28px;' id='content' onfocus='this.style.fontSize="12px";' onblur='this.style.fontSize="28px"'>test</textarea> [/CODE] | |
Re: [iCODE]{ redirect_to(index.php); }[/iCODE] needs to be in quotation marks: [iCODE]{ redirect_to("index.php"); }[/iCODE] Then go to index.php and make sure the page starts with: <?php session_start(); | |
Re: On the SECOND link you provided, look for the post by andy (August 11, 2009 at 3:52 am ). It has the code you need AND a full downloadable demo. If you do NOT want the numbers, then simply OMIT [iCODE]$pages->paginate();[/iCODE] | |
Re: select the divs whose class contain "myDivs", do an each() and within the function check the numeric suffix of the class [CODE=html] <!DOCTYPE html> <html> <head> <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script> <script> $(function(){ $("div[class*=myDivs]").each(function(){ var id=($(this).attr('class')).match(/(\d+)$/)[0]; if( 7 <= id && id <=12) { doSomething( id, this.className ); } }); }); function doSomething(id, … | |
Re: copy and paste the following and give it a try: [CODE] <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title></title> <script type="text/javascript"> var data=null; function gatherData(f) { var str={}; var i=-1, limit=f.elements.length; while( ++i < limit) { str[ f.elements[i].name ] = f.elements[i].value; } data=str; … | |
Re: change: Resource id #2 to: $con | |
Re: try: [CODE=php] <?php if( isset($_POST['submit']) && $_POST['submit']=='OK' ) { $data=$_POST['anything'].PHP_EOL; $file=dirname(__FILE__) ."/form_output.txt"; if( file_put_contents( $file, $data, FILE_APPEND) ) { echo "unable to write to file. Verify path and permissions"; } } ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html> <head> <meta content="text/html; charset=ISO-8859-1" http-equiv="content-type"/> <title>Test</title> </head> <body> <form … | |
Re: In ajax.php change $_GET to $_POST. In index.php update the following javascript function: [CODE=javascript] function display_data(client_id) { xmlhttp=GetXmlHttpObject(); if (xmlhttp==null) { alert ("Your browser does not support AJAX!"); return; } var url="ajax.php"; var parameters="client_id="+client_id; xmlhttp.onreadystatechange=function() { if (xmlhttp.readyState==4 || xmlhttp.readyState=="complete") { document.getElementById('employ_data').innerHTML=xmlhttp.responseText; } } xmlhttp.open("POST",url,true); xmlhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); xmlhttp.setRequestHeader("Content-length", parameters.length); xmlhttp.send(parameters); … | |
Re: assuming you have a unique identifier for each person (like an email address or an auto-incremented db id), you can combine it with time() and feed it to md5(): [CODE] echo $tmp = md5($_SESSION['email'].time()); //you would then save this $tmp key onto a db table (make sure that the field … | |
Re: Did you remember to initialize n to zero somewhere? Did you remember to use [iCODE]dataType: "xml"[/iCODE] in your jQuery ajax options? | |
Re: [CODE=php] <?php $start = strtotime("{$startdate} {$starthour}:{$startmin}"); $end =strtotime("+{$hour} hours +{$minute} minutes",$start); echo 'Start Time'. date('Y-m-d H:i:s', $start); echo 'End Time'. date('Y-m-d H:i:s', $start); ?> [/CODE] | |
![]() | Re: a. make sure that you are posting to the same server where your test page resides b. make sure you are posting to a page that ends in ".php" c. make sure you have loaded your base via "http://localhost", and NOT as "file:///" |
Re: on lines 44 and 49 you have: [iCODE]UPDATE tbl_category SET cat_name ='$name2' WHERE cat_id = '$name'[/iCODE] If I am not mistaken it should be [iCODE]... WHERE cat_id=$cid[/iCODE] Also, on line 10 put the following: [iCODE]$cid = isset($_POST['catId']) ? $_POST['catId'] : 0;[/iCODE] | |
Re: If you keep a field as "disabled" the browser will not submit/post the value to the server. You can change that to readonly instead and THEN it should submit the value of the text field. | |
Re: If the result being returned from the server has leading and/or trailing blank spaces, then the if condition will always evaluate to false. Try using [iCODE]if( resp.indexOf("Email is available") >-1)[/iCODE] instead. | |
Re: if you want the browser to actually navigate to joke.text then change your form to: [CODE] <form method="post" action="joke.txt"> <input type = "submit" value = "Fetch Answer"> </form> [/CODE] | |
Re: [CODE=javascript] <html> <head> <script> url = new Array(); url[0] = new Array(); url[0][0]=['http://www.URL1.com','http://www.URL9.com']; url[0][1]=['http://www.URL2.com','http://www.URL10.com']; url[0][2]=['http://www.URL3.com','http://www.URL11.com']; url[0][3]=['http://www.URL4.com','http://www.URL12.com']; url[0][4]=['http://www.URL5.com','http://www.URL13.com']; url[0][5]=['http://www.URL6.com','http://www.URL14.com']; url[0][6]=['http://www.URL7.com','http://www.URL15.com']; url[0][7]=['http://www.URL8.com','http://www.URL16.com']; url[1] = new Array(); url[1][0]=['http://www.URL17.com','http://www.URL25.com']; url[1][1]=['http://www.URL18.com','http://www.URL26.com']; url[1][2]=['http://www.URL19.com','http://www.URL27.com']; url[1][3]=['http://www.URL20.com','http://www.URL28.com']; url[1][4]=['http://www.URL21.com','http://www.URL29.com']; url[1][5]=['http://www.URL22.com','http://www.URL30.com']; url[1][6]=['http://www.URL23.com','http://www.URL31.com']; url[1][7]=['http://www.URL24.com','http://www.URL32.com']; function newURL(){ var f=document.forms[0]; try{ var u = url[f.gender.selectedIndex][f.grade.selectedIndex][f.classroom.selectedIndex]; alert(u); window.open(u,'_self'); }catch(e){ alert("All Fields are required"); } } … | |
Re: If you are asking if you can run local php scripts (scripts that do not fetch anything from a remote website), then yes. Simply open your browser to [url]http://localhost/yourScript.php[/url] However, if your php script is doing some curl request to some remote server (like google for example), then no. You … | |
Re: try adding the apostrophes to the list of chars in $valid_chars_regex OR simply use str_replace() after your preg_replace() on the code you posted: [CODE] $file_name = preg_replace('/[^'.$valid_chars_regex.']|\.+$/i', "", basename($_FILES[$upload_name]['name'])); $file_name=str_replace("'","",$file_name); if (strlen($file_name) == 0 || strlen($file_name) > $MAX_FILENAME_LENGTH) { HandleError("Invalid file name"); exit(0); } [/CODE] | |
Re: you need to make sure that in your html markup you have some element with id="skin_fenav1" ex: [iCODE]<div id="skin_fenav1">...</div>[/iCODE] | |
Re: try: [CODE] function submitform() { document.comm.submit(); setTimeout(function(){self.close();}, 50); }[/CODE] | |
Re: what if you do: [CODE] <p id="Generate"> <a href="index.php?act=generate_quotes&cb=<?php echo time();?>" class="main_control">Generate</a></p> [/CODE] | |
Re: do you have a demo link to your page so I can see the output of the above script? | |
Re: read the comments and copy and paste the following: [CODE=php] //NOTE: if a field is of type INT, then do NOT put apostrophes around the value. //For example, if ID is an integer then simply use // ... WHERE ID=%s //the same rationale applies for other fields (like size) //Lastly … | |
Re: [CODE=php] <?php mysql_connect("locahost","username","password") or die(mysql_error()); //change "dbname" to the name of your actual database mysql_select_db("dbname") or die(mysql_error()); //change "TABLENAME" to the name of the actual table you have $result=mysql_query("SELECT `names` FROM TABLENAME`") or die( mysql_error() ); while( $row=mysql_fetch_assoc($result) ) { echo '<div>' . $row['names'] . '</div>'; } mysql_close(); ?> [/CODE] | |
Re: $result = mysql_query("SELECT `Pass` FROM `wiki` WHERE `User` ='" . $user ."'"); if (!$result) { die( mysql_error() ); } elseif( !mysql_num_rows($result) ){ echo "No records matched your search criteria"; } else{ $row = mysql_fetch_assoc($result); $pass = $row['Pass']; echo "found: " . $row['Pass']; } mysql_free_result($result); mysql_close($con); | |
Re: [CODE=javascript] function CloseDiv() { var control = document.getElementById("divReqStages"); control.style.visibility = "hidden"; document.getElementById('DDLReqStages').selectedIndex=0; } [/CODE] | |
Re: [QUOTE]Thanks for the tip, I just fixed it, but we are really on a different page (literally!). This whole topic should be about the page /verify.php, not /index.php[/QUOTE] I know you were in verify.php but your pages are "interconnected" since you start at one page and as you proceed at … | |
Re: put a STYLE tag at the top of your html page with the css definitions that you want - ex: [CODE=html] <style type="text/css"> img{ margin-right: 15em !important;img{margin-right: 15em !important; border:2px solid #000;} </style> [/CODE] if you have other images that should NOT be affected by the above changes, then give … | |
Re: [QUOTE]Is it possible for the second page to submit its form along with the $_post which contains the information from the first page?[/QUOTE] No. as soon as page2 completes execution (basically once it loads in your browser) the current page variables cease to exist. The only reason why the data … | |
Re: IMHO, this is simpler: [CODE=php] $arr_pcs = array("3408","1203","3421"); echo "'" . implode("','",$arr_pcs) . "'"; [/CODE] | |
Re: You need to make sub-arrays: 'OldValidFrom'=> array("25/08/2010","26/08/2010","27/08/2010"), 'OldValidTo'=> array("26/08/2110","26/08/2110","27/08/2110"), | |
Re: When you execute [icode]Select Acc_id FROM ... [/icode] then your RESULT set should have a "field" named Acc_id. So: [icode]rs.Fields("Acc_id")[/icode] should give you the value of Acc_id in the db table. However, if you are executing [icode]Select Max(Acc_id) FROM ... [/icode] then your RESULT will NOT have a field name … | |
Re: [QUOTE]But when i modifies one record of a particular customer[/QUOTE] you need to also submit the id of that particular customer. Assuming each customer record has unique key (PRIMARY KEY) named 'cust_id', then on you also need to include it on your form (perhaps as a hidden field). So when … | |
Re: If you don't have Firefox, install firefox. Install the Firebug Addon. After restarting firefox, load your page again. It should tell you a more helpful description of the problem. If the problem persists, post a link to your page. | |
Re: if you are referring to classes, see below: [CODE=php] class className{ private $property1="hello"; public $property2="goodbye"; }[/CODE] | |
Re: try: [CODE=php]header("refresh: 1; url=" . $_SERVER['PHP_SELF']); echo substr(time(),-2,2);[/CODE] [url]http://www.desilva.biz/php/phprefresh.html[/url] | |
Re: If I understood you correctly, this is what you want: [CODE=php] ... echo "<input type='checkbox' name='register[]' value='$tag' />$tag\n"; ... [/CODE] | |
Re: [QUOTE]im using this code to make selection field. Here i want to get a Item ID when selecting Item. bt i cant change that Price as the "value=" of the Option. because i need value as a price for the bill counting[/QUOTE] OK, so currently for every record you are … | |
Re: [CODE] <?php if( isset($_POST['Submitter']) && !empty($_POST['Submitter']) ) { $to = "reciever@example.com"; $subject = "Test Subject"; $body = "Test Body"; $headers = "From: sender@example.com\r\n" . "X-Mailer: php"; if (mail($to, $subject, $body, $headers)) { echo("<p>Message sent!</p>"); } else { echo("<p>Message delivery failed...</p>"); } exit(); } ?> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 … | |
Re: [QUOTE]xpath('//table/tr[td[@class="tickerSm"]') can get: ...reportdate [/QUOTE] that should be getting your BOTH 'reportdate' and 'Cash & Equivalents' since it too has class="tickerSm" From what you posted: xpath('//table/tr[1]) should give you 'reportdate' row xpath('//table/tr[2]) should give you 'Cash & Equivalents' row xpath('//table/tr[3]) should give you 'Receivables' row | |
Re: Try: [CODE=mysql] strQuery = " SELECT SUM(`Production`) FROM` MONTHLYPROD` WHERE (STR_TO_DATE(`DATE`,'%m/%d/%Y') BETWEEN STR_TO_DATE('01/12/1999','%m/%d/%Y') AND STR_TO_DATE('01,02,2000', '%m,%d,%Y') ) AND (`UNIQUEID` LIKE '"+engineName+"')"; [/CODE] | |
Re: assuming your fields are named `GP` and `PTS`: [CODE] <?php $result = mysql_query("SELECT * FROM stats1011 where 1A = 'BULL' OR 1B = 'BULL' order by field(pos,'LW','C','RW','D','G'), Last ASC") or die(mysql_error()); ?> <?php echo "<table width='150' border='1' cellspacing='0' cellpadding='1' bgcolor='ffffff'>"; echo "<tr> <tr bgcolor='000000'> <td align='center'colspan='5'><img src='/images/bar_bull.jpg' width='150' height='19' border='0'></td> … | |
Re: Generally, when a function/method call returns something, and you need that something later on, you need to "receive/assign" it to something else. Your [iCODE]$post->get_news($user_id);[/iCODE] returns an array, but there is NOTHING "receiving" that array. Also, just because your method get_news() returns an array, it does NOT "overwrite" the $post variable. … | |
Re: That ":hover" will likely not be recognized by IE 6. There are a lot of users still using that browser. Try the following instead: [CODE] <html> <head> <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script> <script> //cache the images first var imgs=[]; imgs[imgs.length]=new Image(); imgs[imgs.length-1].src='images/numr.png'; imgs[imgs.length]=new Image(); imgs[imgs.length-1].src='images/num1.png'; imgs[imgs.length]=new Image(); imgs[imgs.length-1].src='images/num2.png'; imgs[imgs.length]=new Image(); imgs[imgs.length-1].src='images/num3.png'; $(document).ready(function(){ … | |
Re: [CODE=html] <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <title>Untitled</title> </head> <body> <form> <input type="checkbox" name="agree" value="yes" onclick="Submitter.disabled = !this.checked" />Do you Agree? <input type="submit" name="Submitter" id="Submitter" value="Submit" disabled="disabled"/> </form></body> </html> [/CODE] | |
Re: Use the DATE_ADD() function to determine the seventh birthday: [url]http://dev.mysql.com/doc/refman/5.0/en/date-and-time-functions.html#function_date-add[/url] Then combine it with the DATE_FORMAT() to format the output: SELECT DATE_FORMAT(DATE_ADD(`user_birth_date`, INTERVAL 7 YEARS), '%m/%d/%Y') as seventhBDay | |
Re: In your php.ini file look for "display_errors" and set it to Off. If you don't have access to the php.ini file, then at the START of your php file put: ini_set("display_errors","Off"); |
The End.