Images Not Saving and PDF file not generating accorading

Dear Team i have waste several days to identify the issues of my web page.but it is not head up me. could you please tell me why my add_type.php page and add_type.tpl.php template page. when i try to add images it is not going to save on my database. please see the attached of my pages. once data is stored except images all are in the database table. please provide me why this is happening.


add_buy.tpl1.txt (45.2 KB)

add_buy.txt (18.2 KB)

The code you have posted seems to be a random collection of things that don’t go together and there’s little anyone here can tell you as to what the code is actually doing or why it is not working.

Your client-side code is using both a type=‘files’ form field and the jquery ui Plupload widget and the server-side code is testing data in the $_FILES array that would come from the type=‘files’ form field, but is using a file upload handling class that you have neither identified or posted the code for, and doesn’t have any error handling, so wouldn’t display anything if there is an upload error. The url that the jquery ui Plupload widget uploads data to is different from the php code you have posted, so there’s nothing at all that can be said about what it might or might not be doing.

I recommend that you start with just a type=‘files’ form field and that your form processing code needs to have some error handling in it so that your code will tell you if and why it is failing.

Also, is your development system set up with php’s error_reporting set to E_ALL and display_errors set to ON, so that php will help you by reporting and displaying all the errors it detects and does the custom database class you are using have any error handling for the database statements?

Lastly, you have far too much code for what it is trying to do, making it hard for anyone to see what it is trying to do or debug why it isn’t working. You need to Keep It Simple (KISS.) You need to write the simplest program logic that accomplishes a task. Some suggestions -

  1. The post method form processing code needs to be toward the top of the file. The get method code needs to come after the post method form processing code.

  2. Don’t create a bunch of discrete variables for the form data or the result from database queries. This is just a bunch of typing that is wasting your time and then requires more of your time fixing any typos. Use an array for the form data and any result from database queries.

  3. If you use an array to hold error messages, it will simplify the code and allow you to display each error next to the form field it corresponds to.

  4. When a form is submitted all the type = text/textarea/number/hidden form fields will be set. Only checkbox and radio buttons may not be set. Some of the isset() statement you have are not needed and may be hiding problems with the form.Also, $_FILES is always set, even if it is empty, so the isset($_FILES) in the code is always true.

  5. Creating/Updating/Deleting landlord information is a separate process from Creating/Updating property information and should be handled separately. When Creating/Updating property information, you should only be selecting from existing landlords and there should be a database table that holds the property id and landlord id relationships. The property id should not be stored in with the landloard data.

  6. The literal numbers that are being used as message numbers should use defined constants so that anyone looking at the code can tell what they mean. There’s also no good reason to base 64 encode those numbers. All it does is add code and clutter to what you are doing.

  7. Don’t write conditional statements testing if a Boolean result is ==TRUE. The whole point of Boolean results is they can be directly tested by conditional statements.

  8. Where you are testing multiple submit button names, you should instead use one name for all the submit buttons, but use different values. You can than just use in_array() to detect if the submitted value is one of several possible choices.

  9. $_SERVER[‘PHP_SELF’] is not safe to use (allows cross site scripting). Either apply htmlentities() every place you are echoing $_SERVER[‘PHP_SELF’], or just eliminate $_SERVER[‘PHP_SELF’]. All modern browsers will submit forms and links to the same domain as the current page when you use relative urls.

  10. You should not store user permission information in session variables. This prevents someone from assigning or changing the permission level of a user without requiring the user to log out and log back in. You should only store the user id in a session variable, then query your database table holding permission information on each page request to get the current permissions for the user.

I would also suggest putting you code in php tags.

For example:

[php]/* Get the current page */
$phpSelf = filter_input(INPUT_SERVER, ‘PHP_SELF’, FILTER_SANITIZE_URL);
$path_parts = pathinfo($phpSelf);
$basename = $path_parts[‘basename’]; // Use this variable for action=’’:
$pageName = ucfirst($path_parts[‘filename’]);[/php]

There are people that won’t open file attachments (I’m usually one) and besides it is easier to look at the code that is directly facing you.

Sponsor our Newsletter | Privacy Policy | Terms of Service