812 Posted Topics
Re: It might be hard to mix PHP code with HTML with this style of programming. You will be more or less limited to generate all HTML code with PHP I guess. Is that what you really want? And what is the role of the line 3 above (initialization of StdClass)? … | |
Re: In your php script that generates pdf you have to override existing method Header() with your code.There are nice examples on their website, see [url]http://www.tcpdf.org/examples/example_003.phps[/url] To add custom text to the header use the Cell() method. | |
Re: Where do the $p_spice, $p_veg and $p_allergy that you use as conditions in your if statements come from? Shouldn't they be a part of the $row array (like $row['p_spice'])? I presume the paths to images are OK. There is an error in line 26 where you say [CODE]$nut='<img src= src="../Resources/nut.png" … | |
Re: I will try to explain my approach since I also use TinyMCE. I use two divs: the first div holds a textarea (TinyMCE editor), a Save button and a Cancel button. The other div holds edited text as an ordinary paragraph and an Edit button. One div is hidden (display:none) … | |
Re: You will have to query the database for number of matches form your dropdowns using COUNT(*) function. You can use a query in mysql for your example similar to: [CODE]SELECT COUNT(*) FROM databasename WHERE Country='France' AND Age BETWEEN 18 AND 40 AND Education='High School' AND InterestA='Reading'[/CODE] Just to give you … | |
Re: You could use an obfuscator. It is not a 100% solution and it might create some work when maintaining but it is an option. Have look at [url]http://www.phpprotect.info/[/url]. | |
Re: And it also depends on the table type (engine) within a database. In mySql it is possible to do it if table type is InnoDb, but not if the type is MyIsam. | |
Re: If password which is stored in the password database field is hashed (using md5 or sha1 function) then you have to also hash the password provide by the user (typed into a login form) and compare the hashes. [CODE]$hashed_password = sha1($passwod); // ... $sql = "SELECT * FROM skadate_profile WHERE … | |
Re: Have a look a this link: [url]http://www.javascriptsource.com/page-details/session-time-out.html[/url] | |
Re: To export a PDF I use an open source TCPDF library ([url]http://www.tcpdf.org/[/url]). It has an excellent page with man examples: [url]http://www.tcpdf.org/examples.php[/url]. Hope it helps. | |
Re: Do you have session_start() function at the beginning of your script? If not it won't work. Check the $_SESSION contents with [CODE]print_r($_SESSION);[/CODE]and compare it with the value of $HTML[CODE]print_r($HTML);[/CODE] | |
Re: Your code is OK. I have been using this approach quite often (e.g. conditionally applying a background colour to a table). What makes you think the code does not work? Maybe the change just isn't visible. Try changing some other attributes to see whether there is any effect. Try: [CODE] … | |
Re: See an example here: [url]http://www.daniweb.com/web-development/php/code/379236/page2[/url] Have look at the last post with improved code (the code in the first post was criticised rightly for lack of security measures). | |
Re: I am not sure whether I understand your question but let me try. Enclose each of your forms with a div that has a CSS display property set to none like this: [CODE]<div id="form1" style="display:none;"> <form> ... ... </form> </div> <div id="form2" style="display:none;"> <form> ... ... </form> </div> [/CODE] Then … | |
Re: It is a bit difficult to give you an exact answer but I think your Quiz class should have all the attributes and methods to handle the quiz, such as a method to display a question (which you already have), an attribute (an array) with correct answers for all questions, … | |
Re: Your input should be between the <form></form> tags and the form should have an action attribute set to the same page. | |
Re: You are missing a curly bracket at the end of line 9 jn the above code. [CODE]$distance = $cities[$_POST['destination']]};[/CODE] | |
Re: Man, you must be in love with the if clause. It seems that you have one curly bracket missing at the end between lines 168 and 179. Your code is very complex and hard to follow but my IDE shows that what is marked as: [CODE]}//end foreach[/CODE] is really end … | |
Re: The third block of code is OK, that is how you do it. Of course you can also have functions in a separate file like in your second block example in the fix_name.php file. Only the line 4 of the second block should be: [CODE]echo fix_name("costa playa");[/CODE] | |
Re: PHP6 and MySql Bible, Wiley, was very informative for me (note PHP6 is not out yet, but the book it is OK for PHP5 too). [url]http://www.amazon.com/PHP6-MySQL-Bible-Steve-Suehring/dp/0470384506[/url] | |
Re: You should set atribute name of the checkbox to[CODE]name='item[]'[/CODE]so that you create a checkbox group. Upon submitting the form you will get all checked values in an array stored in $_SESSION. The array can be empty if none of the checkboxes were checked, so use empty() to check for values … ![]() | |
Re: \n is not a html tag. It does insert a new line in the source (view page source and you will see it). To have a new line in html page you need to use either <br /> or wrap each line in <p></p> or <div></div> pair like [CODE]echo "<div>value … | |
Re: There are a couple of mistakes in your code: 1. you declare $nome=$db_field['name']; on line 19 and then use value="$nsme" on line 39 (typo?) 2. you declare $cognome=$db_field['gender']; on line 20 and then use value="$gender" on line 43 (shouldn't it be value="$cognome") 3. your <'php opening tag is not followed … | |
Re: You probably have a quantity in input field and total somewhere in text (i.e in a div or span element). Both elements should have unique ID so their values can be read by javascript. In addition you should have a button with onclick event attached that fires your javascript function. … | |
Re: I use TCPDF which is licenced as LGPL and available at: [url]http://www.tcpdf.org/[/url] There are plenty of examples on the site to get you started: [url]http://www.tcpdf.org/examples.php[/url] | |
Re: You need: 1. an editor that helps PHP development. PHP Eclipse ([url]http://www.phpeclipse.com/g[/url]) and Netbeans ([url]http://netbeans.org/[/url]) are probably most wide spread but for a beginner maybe a little overwhelming. Notepad++ (Windows) and Kwrite, gedit (Linux) are simpler and still powerfull ones. 2. a PHP and mysql enabled web server (can be … | |
Re: Move the curly brace form line 49 to a line 29. Your second if block should be a part of your first if block which means if form has been submitted and if password is correct then display the greeting else display the table with the form. See the code … | |
Re: On Linux (maybe on Windows too) you can use mysqldump command to backup mySql database in a SQL script. Optionaly the script can be compressed (gzipped in this example). [CODE] // username, password, mysql host, database name $dbuser = 'yourMysqlUsername'; $dbpw = 'yourMysqlPassword'; $dbhost = 'yourMysqlHost'; $dbname = 'yourMysqlDatabaseName'; // … | |
Re: I use Pager from the Pear framework. Have a look at [url]http://www.alberton.info/pear_pager_tutorials.html[/url] and [url]http://pear.php.net/package/Pager/docs[/url] Unfortunately you have to be familiar a little with how to install Pear components but it is not very hard. ![]() | |
Re: You can not access the class variable that has been declared as private from outside the class. You either declare it public (instead of private) which is really not a good practice or add a method that returns the value of the variable. [CODE]class bag{ private $no_of_items=0; private $sub_total; public … | |
Re: I thing the cause of trouble could be in your query in a comment section (line 2): [CODE]$query_news = ("SELECT * FROM newscomments WHERE nid = id");[/CODE] id should probably be a PHP variable, maybe $id? Just a guess. [CODE]$query_news = ("SELECT * FROM newscomments WHERE nid = $id");[/CODE] | |
Re: Use Javascript for printing. The view button type attribute should be 'submit' while the print button type attributeshould be just 'button'. Then asign a javascript function to the print button like this: [CODE]<input type="button" onClick="window.print()">[/CODE] | |
Re: My guess: make sure that table book does not already exist. Add IF NOT EXISTS to the query. [CODE]CREATE TABLE IF NOT EXISTS book( bookid SMALLINT(10) NOT NULL AUTO_INCREMENT, PRIMARY KEY(bookid), author VARCHAR(30), title VARCHAR(30), accessno INT(20),edition INT(20),publisher VARCHAR(30), copies INT(10), status VARCHAR(30),CONSTRAINT fkbook FOREIGN KEY (status) REFERENCES issue(status))[/CODE] | |
Re: One way of doing it: [CODE]$brush_price = 5; $counter = 10; // row for quantities with heading in first cell $qtyRow = '<tr><th>Quantity</th>'; // row for prices with heading in first cell $priceRow = '<tr><th>Price</th>'; // add cells to each row while ( $counter <= 100 ) { $qtyRow .= … | |
Re: In the second situation use two div elements each containing the form elements for one radio button and one div being visible (display:block) and other hidden (display:none). Radio buttons should have JS code which is fired on onclick event and toggles the visibility of both div elements. ![]() | |
Re: See differencies between GET and POST here: [url]http://wiki.answers.com/Q/What_is_the_difference_between_get_and_post_method_in_HTTP[/url] And more indepth here: [url]http://www.cs.tut.fi/~jkorpela/forms/methods.html[/url] | |
Re: Depends on the operating system on your VPS ant the service in question I guess. If it is Linux you can use the following command to enable e.g. the Apache webserver service which will still run after you log out (on Fedora 15): [CODE]/sbin/chkconfig httpd on[/CODE] Service control is becoming … | |
Re: Your query should return only records for users whose expiry date is 7 days or less. That is why your mailing code should go into the while loop which steps through the result set. I suggest you check what your query returns. comment out lines 60 and 62 and add … | |
Re: What are variables $s1i, $s2i... and $s1s, $s2s... and where they get their values from? Do you get any error messages? What is the structure of the class table? | |
Re: Introduce a foreign key in Table B which then have two fields: dst_code_fk with values 011, 012, 013... and fee with values 0.38, 0.55, 0.55... Then use join and if you want to find out a fee for dst_code 011 do it like this: [CODE]SELECT table_a.fee FROM table_a LEFT JOIN … | |
I have prepared an example of login page which displays a form with inputs for username and password and compares submited values with records in database. If match is found the user is redirected to another page, if not error message is displayed. This example is heavy commented. Hope it … | |
Re: You should set $_SESSION['loggedin']='1' only after the successful login not in the beginning of the script. | |
Re: I am not sure if I understood the question but if you do not want to get the green $clubName parsed and replaced with it's value either escape the $ like \$clubName or put the whole string in single quotes and xml attributes in double quotes like:[CODE]$new_xml = '<?xml version="1.0"?>-<params>-<param><key>$clubName</key><textValue>' … | |
Re: The first thing I note is the missing ; in line 56 in the above listing. | |
Re: The HTML code (second snippet) seem not to be generated from the PHP code in the first snippet since PHP code says id='gridRow' (single quotes) and HTML generated is id="gridRow" (double quotes) I would code like this (all HTML attributes in double quotes): [CODE]echo "<tr id=\"gridRow\"> <td >$count</td> <td> <input … | |
Re: If session is stored in a filesystem it is stored as plaintext and every user having access to directory can read the session data (at least root and sudoers). If it is saved in a database only users that have access to database and appropriate permisions can read the data. | |
Re: Try to surround code in header.php with <?php ?> tags. [CODE]<?php <div id="header"> <h2>1stWebDesigner PHP Template</h2> </div> ?>[/CODE] | |
Re: Use print_r($mysql_result) to se what $mysql_result realy contains. Maybe it is an array. | |
Re: It is quite easy in PHP. You set form action to the same page and then first check wheter $_GET (or $_POST if method is post) array contain any submited values. The values that exist can be used for the HTML you wish to display below. An example: [CODE]if(isset($_GET['select1'])) { … | |
Re: I use FPDF. On [url]http://www.fpdf.org/[/url] you have nice tutorials. |
The End.