812 Posted Topics
Re: The `printList()` should return a value if you want to use it in assignment (line 3 in the first snippet). function printList($file_names){ //print the list echo "<p class=cart-list-header ></p>"; echo "<ul class=cart-list>"; $pdf_check = glob('pdf/*.pdf'); $tpdf = array(); foreach($pdf_check as $pdf){ $tpdf[] = substr($pdf, 4); } foreach($file_names as $file){ if … | |
Re: Maybe there is something wrong with your update query (maybe the `$sender` or `$total` are not what you expect). You can simply check it by sticking the following piece of code right after line 24: die($query); This will display your update query with the parameters and stop the script. Now … | |
Re: [PHPAcademy](https://phpacademy.org/) if you are more of a visual type of person. | |
Re: Are you talking about database records? What is the table(s) structure? | |
Re: I have been watching this article with much interest hoping that someone will post their solution or ideas. Since there is no much activity so far maybe just a thought or two: if you set up a session handler to use database instead of temp file storage, you might have … | |
Re: I would use one of jquery UI plugins. [Recommended reading](https://www.daniweb.com/web-development/php/threads/435023/read-this-before-posting-a-question). | |
Re: It would be much easier if you posted the code in question especially the part arround line 9. Nevertheless, it looks like you are missing a closing `)` somewhere. | |
Re: The `session_start` function must be called before any html is sent. Best place is on very top of the script: <?php session_start(); ?> ... margin-left: 94px; margin-top: -66px; margin-left: 94px; margin-top: -66px; max-width: 100%;"/></a></h1> ... See the PHP manual entry for the [session_start function](http://php.net/manual/en/function.session-start.php), especially the Notes part. | |
Re: Haven't studied your code closely but the number 2147483647 is exactly the max [integer](http://php.net/manual/en/language.types.integer.php) value on 32 bit systems. Why do you not handle your phone number as a string? | |
Re: If you want to translate the above `ifs` into `switch` correct way as I see it would be: switch($temp) { case 0: echo "it's 0 Celsius"; break; default: switch($temp > 0) { case true: echo "it's not chill outside"; break; default: echo "it's chill outside"; } } Another way of … | |
Re: The simplest way is to enclose the whole html table within a form. In each row there is a delete button which is actually an input element with a type="submit". The name attribute of each delete button should be a corresponding ID of the row in the database (typicaly a … | |
Re: Welcome to Daniweb. Please read [this sticky](https://www.daniweb.com/web-development/php/threads/435023/read-this-before-posting-a-question). This is the first hit from [duckduckgo](https://duckduckgo.com/?q=php+forgoten+password+script) search: http://www.plus2net.com/php_tutorial/php_forgot_password.php and there are heaps of others. You can find a lot of useful stuff regarding your question on this forum, too. | |
Re: Maybe this is not an answer to your question but I was just wondering why you do not use any of the ready made solutions for pagination. You can find some examples on [phpclasses.org](http://www.phpclasses.org/search.html?words=pagination&x=0&y=0&go_search=1) (they will want you to sign-up to download the code but I think it is worth … | |
Re: Provided that you keep user data in a database, just add a field containing the path to the image. You can provide default image (or two, based on sex) and add a functionality for users to provide their own photos. | |
Re: I had a quick look at the code and the main error is that you are missing a method attribute in the form, so it defaults to GET, but you are using POST parameters. So change the form line to: <form action="post" id="nl-form" class="nl-form" action="../EMAIL.php"> There are other errors too, … | |
Re: Have you installed fpdf correctly so the directory structure is preserved. Font definition files are usually in font subdirectory of the fpdf installation. Check if this is so and if the `helveticab.php` file exists there. | |
Re: The problem is in the name of the `References` field (column) which is a Mysql reserved word and should not be used as a field name. If you still wish to use it as a field name you should enclose it in backticks. I would recommend you change it so … | |
Re: In the `Test_2` method the `$rootName` is not defined so it won't work. Anyway, I do not see any added value in your approach. You could do all this just by using json_decode. But if you really want to do it through your custom class then you should have good … | |
Re: What does the error message say apart from Fatal error (post the whole text of the error message)? Also, the mysql_query function returns a resouce (a special php type). Are you sure you want the generateOrderedArray() function to return an array of resource? You might wanna look at [the manual](http://php.net/manual/en/function.mysql-query.php) … | |
Re: I'll do a bit of guessing here since I do not have experience with MS SQL server. It seems that MS SQL support is not installed in your EasyPHP environment (default is mySql). There is some info on [this link](http://stackoverflow.com/questions/14631988/trying-to-install-mssql-drivers-with-easyphp-12) on how to do it. | |
Re: Is line 76 of the input_image.php actually a line 13 in the above snippet? If yes, obviously `$_SESSION['adm_banner.jpg']` does not exist. Where is it supposed to be set? | |
Re: If you do not have image ID then `$data` array is not set. You should check for it before using it, especially in these two lines: if(isset($data['image']) && isset( $data['newfilename'])) { echo $data['image']; echo '<div id="updateimage"><img src="images/'.$data['newfilename'].'" height="250px"></div>'; } | |
Re: You have to use a [HTML form](http://www.tizag.com/htmlT/forms.php) here. The action attribute of the form should point to the script that will process the data (validate it, sanitize it and store it into the database). The method attribute (get or post) will define how the form will be posted (`post` method … ![]() | |
Re: Seems like some obfuscated php code. The author probably did not want others to see it without a lot of effort. Might be connected to the copyright notice in the beginning of the script. | |
Re: Show the code, especialy the part that contains line 7. | |
Re: I have tested your script and it works OK. This is the data I tested on: INSERT INTO book (id, bname, aname, pname, description) VALUES (1, 'Book 1', 'Author 1', 'Publisher 1', 'Description 1'), (2, 'Book 2', 'Author 2', 'Publisher 2', 'Description 2'), (3, 'Book 3', 'Author 3', 'Publisher 3', … | |
Re: You shall not send any HTML output before the `header` function. It won't work. So rearrange your code. Something like: <?php if($username=="" && $password=="") { header('location:admin.php'); exit(); // add this for security } else if($username=="hijran" && $password=="khan") { header('refresh:5; user.php'); } else { header('location:error.php'); exit(); // add this for security … | |
Re: There are many ways: save it (database, json), store it in session, use $_POST/$_GET... Post what you have so far and describe what you want to achieve. | |
Re: You should put the `session_start()` command on top of the `admin.php` script for session to work. | |
Re: Before writing a next task to the database you read the last task. However, if the user has the form opened in the browser, there might be a problem displaying the current last inserted task ID, since many tasks could have been inserted after opening the form. You can use … | |
Re: https://www.daniweb.com/web-development/php/threads/488707/how-to-use-cookies-in-a-website-through-php http://davidwalsh.name/php-cookies ... | |
Re: The `else if` part of the code (line 23) should contain a condition. The rest of the answer is waiting for you [here](https://www.daniweb.com/web-development/php/threads/488599/cant-redirect-to-adminuser-page-after-login#post2137412) (similar post you started earlier on). | |
Re: You can not send headers after you have sent HTML output. Move the following block of PHP code to the top of the script and you'll be fine: if(isset($_POST['login'])) { $uname = filter_input(INPUT_POST, 'username', FILTER_SANITIZE_SPECIAL_CHARS); $pword = filter_input(INPUT_POST, 'password', FILTER_SANITIZE_SPECIAL_CHARS); if ($uname=="nitcoadmin" && $pword=="nitco@bahrain"){ //$_SESSION['user']=$uname; //$_SESSION['passw']=$pword; // $_SESSION['login']='1'; header('location:enqrep.php'); } … | |
Re: If you want to pass multiple values you can do it this way: xmlhttp.open("GET","getuser.php?q="+str+"&k="+somevalue,true); In this case you will always have both q and k elements in the $_GET array. But it is a question of what you really intend to do. Maybe some other approach is more appropriate. | |
Re: Can you post the code you've done so far. And then more precisely describe what you want but were not able to do. | |
Re: Something like: $rawString = 'aamu.edu: Alabama A&M University'; $temp = explode(': ', $rawString); // $temp[0] -> college_email // $temp[1] -> college_name $query = "INSERT INTO tableName (college_email, college_name) VALUES ('{$temp[0]}', '{$temp[1]}')"; And do not forget to sanitize strings first. | |
Re: To follow good design practices you should keep categories in a separate table. But anyway: - put a select element (a dropdown) or checkboxes on page to let people chose a category/ctagories - create a select statement using a chosen category/categories construct a SQL statement to query the database: $query … | |
Re: In 2.php you should have details enclosed within an html eement (such as div) with an ID so that you can access it using jquery `text()` or `html()` or similar method. <div id="my-content"> This is the body of the email. </div> var emailBody = $("#my-content").text(); | |
Re: The $mail doesn't even come from the form. Should you code it something like: if(isset($_GET['submit']) && isset($_GET['q']) && isset($_GET['email']) { $mail=$_GET['email']; // sanitize this first ... Then the question is what type the email field is. And a side note: vlidate and sanitize the data from the form before you … | |
Re: Not sure if I understood the question but this recursive function will traverse the object, search for a property and display it: function displayElement($obj, $el) { foreach($obj as $key => $val) { if(is_object($val)) { displayElement($val, $el); } else { if($key == $el) { echo "Found $key: $val<br>"; die(); } else … | |
Re: If I got your question right you want to know whether a special character is required in PHP to write a statement on multiple lines. The code in PHP would be: $query = "INSERT INTO table(field1," . "field2)VALUES(value1," . "Value2)"; or $query = "INSERT INTO table(field1,"; $query .= "field2)VALUES(value1,"; $query … | |
Re: It should not be a problem if you use UTF-8 I guess. But anyway, the character code for รถ is `ö` or `ö`. <p>Schönefeld</p> ![]() | |
Re: First store the username in the session variable. // sanitize/validate first //... $_SESSION[$uname] = $uname; On other pages (within the same session) it will be available to your scripts: $uname = $_SESSION[$uname]; provided that you used the `session_start()` (always put it on top of your script). And sanitize the user … | |
Re: Seems to be possible doing this using Javascript. See http://msdn.microsoft.com/en-us/library/office/fp161148%28v=office.15%29.aspx. And use PHP to pepare the HTML part. | |
Re: If you replace the following code: list($ip, $netmask) = split("/", $ipNetmask ); $ip_elements_decimal = split("[.]", $ip ); with this one (for IPv4 addresses): list($ip, $netmask) = explode("/", $ipNetmask ); $ip_elements_decimal = explode(".", $ip ); you should not get the depreciated notice. In fact I think you do not need regular … | |
Re: Something like: $rs2 = mysql_query($sql2); // array of months to get the index $months = array('Jan' => 1,'Feb' => 2,'Mar' => 3,'Apr' => 4, 'May' => 5, 'Jun' => 6, 'Jul' => 7, 'Aug' => 8, 'Sep' => 9, 'Oct' => 10, 'Nov' => 11, 'Dis' => 12); // the … | |
Re: If you know the structure will be exactly like the above: function convertDate($oldDate) { $months = array('Jan' => 1,'Feb' => 2,'Mar' => 3,'Apr' => 4, 'May' => 5, 'Jun' => 6, 'Jul' => 7, 'Aug' => 8, 'Sep' => 9, 'Oct' => 10, 'Nov' => 11, 'Dec' => 12); $temp … | |
Re: See [OWASP Top Ten](https://www.owasp.org/index.php/Top_10_2013-Top_10) especially the A1 - Injection. Probably all the web developer needs to know about the security. It is a lot of stuff to read and you do not have to digest it all at once. But make sure you bookmark it. | |
Re: The main error was in the fact that you should not send any output to the browser before the [header](http://php.net/manual/en/function.header.php) function. In your second alternative coding example above you broke this requirement. In the first example you actualy made a redirection before outputting the script code so the script code … |
The End.