-
Posts
3,145 -
Joined
-
Last visited
-
Days Won
37
Everything posted by cyberRobot
-
Does anyone know of any good resources for building XFA forms in Adobe LiveCycle? Note: I'm mostly interested in writing scripts within XFA forms at this point.
-
You could use the margin property in CSS. input { margin:0 5px; }
-
Have you tried something like this: if (searching by company name) <a href="print_tax.php?company=<?php echo $companyname; ?>">Print</a> elseif (searching by date range) <a href="print_tax.php?from=<?php echo $from; ?>&to=<?php echo $to; ?>">Print</a> Note: the above contains pseudo code. The print_tax.php page could then use the corresponding $_GET variables to pull whatever information is necessary for mpdf.
-
Are you using an HTML form for the print button? If so, pass the data using hidden input fields. Then you can retrieve the data using $_POST or $_GET, depending on what your form's method attribute is set to.
-
Actually, you need to do something like this: $db->query($sql) or die(mysqli_error($db)); At least I think that works with the object form of mysqli_query(). Sorry for the confusion.
-
Have you checked if the query is throwing errors? Note that you are doing that with the first query: mysqli_select_db($db,"") or die(mysqli_error($db)); Try doing the same here: $db->query($sql);
-
Have you tried using mysqli_error() just to make sure? More information can be found here: http://php.net/manual/en/mysqli.error.php Side note: In case you are not aware, the query is susceptible to SQL injection attacks. To protect the query, look into using prepare statements or mysqli_real_escape_string().
-
So basically, you have a form that submits to another page for processing. Now you want to pass the values used in the processing script to another script that uses mpdf. Is that correct? If so, how does the visitor get to the mpdf script page? Do they click a link? Are you using a header redirect? Do you have another form?
-
PHP HTML not working and don't know why
cyberRobot replied to strikeforcefan's topic in PHP Coding Help
Could you provide more information about what "loads of code" means? Does it display actual PHP code? Does it output more content than you expect? If too much content, is there anything specific about the content that would provide a clue as to where the content comes from? Just to take a guess, did you mean to display every user ID and name here: $result = mysql_query("SELECT * FROM tableb ORDER BY id ASC"); $res = mysql_result($result,3,"name"); while($rows = mysql_fetch_assoc($result)){ echo $rows['id'] . ' '. $rows['name']. '<br>'; } Side notes: The INSERT query is executed twice here: $sql = "INSERT INTO tableb (id,name) VALUES ('$id','$name')"; if(!mysql_query($sql)) { die('could not update database'); } else { mysql_query($sql); } And you are sending the same email message twice here: mail($to,$subject,$mes); if(mail($to,$subject,$mes)) { echo 'you sent a mail to me'; } -
If the handle is not provided, mysql_* functions use the last one created. @erez22 - Just to clarify, the above refers to the mysql_* functions. Feel free to continue using MySQL for your database needs.
-
The $special_group variable contains the visitor's group information, so you don't want to overwrite that. You could try something like this <?php $special_group = $client_info['account']['screeningGroup']; $spc_grp_no_spaces = preg_replace('/[\s]+/', '', ucwords(strtolower($special_group))); $groups_with_access = array('Student', 'Medical', 'Testers', 'Contractor', 'Volunteers'); if (in_array($special_group, $groups_with_access)){ //veribage text } ?>
-
You could use JavaScript. Basically, you would add an event listener to your <h2> tag to detect the hover state. When the event fires, you could add a CSS class to your tool-tip text's <span> tag that shows the tool tip. Of course, you would need to add some other event listener so the user can hide the tool tip. Perhaps the tool tip could include a close link. That event listener would remove the class the other listener added.
-
Have you tried outputting $row['userPass'] and $password to see if they contain the same value? Perhaps the password field in the database was truncated. Side note: In case you are not aware, the mysql_* functions have been removed in PHP 7. You will need to switch to PDO or MySQLi in the near future. More information can be found here: http://php.net/manual/en/mysqlinfo.api.choosing.php
-
I just noticed the above text. Does your page need to be named with a .html extension? You typically need to use a .php extension to run PHP. Of course, servers can be configured to run PHP code in .html files.
-
Have you tried using the if construct? Basically, you would enclose the extra verbiage with the if construct. <?php if($special_group == 'group name goes here') { //extra verbiage goes here } ?> If multiple groups need to see the extra verbiage, you could use the in_array() function. More information can be found here: http://php.net/manual/en/function.in-array.php
-
Do you have a way to determine if the certain group is online, such as a login?
-
Getting sum of a column from a table into a textbox
cyberRobot replied to lindisfarne's topic in PHP Coding Help
Side note: In case you are not aware, the mysql_* functions have been removed from the latest version of PHP. You will want to switch to PDO or MySQLi in the near future. More information can be found here: http://php.net/manual/en/mysqlinfo.api.choosing.php -
That depends on what you are looking to do. If you don't need the categories/slugs as a string, you don't need to use implode.
-
I have a feeling it's related to WordPress. The "wtc" part seems like it's connected to the Woocommerce plugin. More information about WordPress slugs can be found here: https://codex.wordpress.org/Glossary#Slug
-
That should work just fine. How often do you think you will need the imploded version of the categories in a single script? Depending on how often you need the value, you can just leave the categories as an array. Then just implode the values as needed.
-
I think you're looking for explode(). More information can be found here: http://php.net/manual/en/function.explode.php
-
Of course, I should mention that the above code doesn't deal with close tags that get cut off.
-
Hmm...that increases the difficulty. You could try something like this: function limit_words($string, $word_limit) { //PREPARE STRING $words = preg_replace('|<br[ /]*>|', ' ', $string); //replace <br> tags with spaces so that "LOCATION</strong><br />Centrally" is not considered one word after HTML tags are removed $words = strip_tags($words); //remove HTML tags $words = preg_split('/\s+/', $words); //split sting into words //LOCATE 30TH WORD $currOffset = 0; $wordsFound = 0; $lastWord = ''; foreach($words as $currWord) { //IF NOT BLANK, FIND CURRENT WORD IN ORIGINAL STRING if($currWord != '') { //IF WORD IS FOUND $newOffset = strpos($string, $currWord, $currOffset); if($newOffset !== false) { //echo "<div>$currWord || $currOffset || $newOffset</div>"; //UPDATE OFFSET AND WORD COUNTER $currOffset = $newOffset; //offset is used so the next word will be found after the current word $wordsFound++; //IF WORD LIMIT WAS REACHED, STORE 3OTH WORD AND BREAK OUT OF THE LOOP if($wordsFound == $word_limit) { $lastWord = $currWord; break; } } } } //RETURN RESULT return substr($string, 0, $currOffset) . $lastWord; } echo limit_words($content,30);
-
Just to clarify, is the problem that the same icon is displayed for all titles? And you want the icon that was assigned to each title to be displayed instead. Is that correct?