Jump to content

rodb

Members
  • Posts

    21
  • Joined

  • Last visited

Everything posted by rodb

  1. Thanks for the help. Did not even think of the properties in the image tag. Just trying to make things harder than they are. Rod
  2. Sorry for not being to clear. Basically if the image is large (say 460 by 480) or larger, I would like to display it as a 180 by 200 (for example). I have no control over what size the image supplied by users will be but would like display them in a fix area on the screen. Hope that explains things better.
  3. Thanks for the reply. The image does show as indicated. However, what I am trying to do is restrict the area where the image is to show. That is why I was using the plugin which is to resize the image to the desire container. In this case want to limit the width to 2 columns wide. I may have to come up with a may to insure the image does not exceed a specific width. Is there a way to have the image to display in a restricted area? Rod
  4. I am trying to set a panel height to display an image. The section of code being used is : <div class="col-md-2"> <div class="panel panel-default"> <div class="panel-body"> <img class="scale" data-scale="best-fill" data-align="center" src="<?php echo $imagedir . '/' . $person['image'] ?> "> </div> </div> </div> I am using a jquery plugin (image-scale.min.js) to resize an image to be displayed in the panel. However the panel has a width of 'col-md-2' but I can not seem to set a height. When the image is displayed the panel is only one row in height therefore I can only get the very top of the image. I have tried creating some css styles to set the height but must be doing something wrong: example of css. .image-container div{ height: 200px; width: 200px; border: 1px solid black; } and it is applied as follows: <div class="panel-body image-container"> help would be greatly appreciated. Rod
  5. I have not found the issue with tab controls. I am using the Toggable/Dynamic Pills example from Bootstrap. From what I see the code appears to be working. When I click any of the pills the proper panel appears and data can be modified (mainly working on the pReceipts panel). When the add new receipt button is triggered the data is added to the database. After the update the main screen appears and the other pills can be selected with proper panels being displayed. So I guess I do not see what you have seen. I do pay attention and try to verify code anytime the experienced members spot something. I am learning and may not find the issue as quickly as liked. I responded to each reply as soon as possible. I am continuing to look for the tab problem Rod
  6. The redirect function is in my library and defined as: function redirect($url, $permanent = false) { if (headers_sent() === false) { header('Location: ' . $url, true, ($permanent === true) ? 301 : 302); } exit(); } Is there a tutorial on dynamically outputting the class as active and changing the default active link as not active. I am trying to learn more on making the app user friendly. I think I will have to do more in javascript based on the command when the page opens. The current page will have at least four panels that are access through the nav-pill navigation. It works with basic functionality by clicking on the various nav-pill options. However, after the user makes changes on one of the panels and submits the changes, I would like the user to automatically see the changes on the panel.
  7. I appreciate the inputs however I am getting the same result. Still shows the default form vs the pReceipts form. I replaced the redirect command with the header command with the appropriate bookmark.
  8. I have tried the page.php#bookmark approach but still do not get the desired results. Here is the command that I am using: redirect('edit_project.php?id='.$project['id'].'#pReceipts', false); which evaluates to edit_project.php?id=1#pReceipts still returns to the active defined nav-pill option #pData
  9. I am using Bootstrap to setup navigation. I have setup a menu scheme on the page that will display different forms for data entry. The nav-pill is a button that causes a specific section (form) to be displayed. After the user enters data (new entry or updates) and submits the data to the database I would like to refresh the page in the specific form so the user would see the changes in the data (verification). Currently when the redirect command is executed the default view is displayed. Thus the user would have to re-select the appropriate button to re-display the edited form. Hope that explains what I am trying to do.
  10. Good morning & Happy New Year. I am fairly new to PHP and am having issue. The issue is trying to redirect back to current page to a specific nav-pill after adding a new record to the associated MYSQL table. My nav-pills are defined as follows: <div class="container"> <ul class="nav nav-pills nav-justified"> <li class="active"><a data-toggle="pill" href="#pData">Project Data</a></li> <li><a data-toggle="pill" href="#pReceipts">Project Receipts</a></li> <li><a data-toggle="pill" href="#Tasks">Tasks</a></li> </ul> </div> After posting a new receipt I would like to redirect back to #pReceipts pill to show the new entry. I think I need some js to handle the redirect but can't seem to get it. The current redirect command is if($result && mysqli_affected_rows($con) == 1){ $session->msg('s',"Receipt Added "); redirect('edit_project.php?id='.$project['id'], false); } else { if (!$err_num) { $session->msg('d',' Error adding receipt!'); redirect('edit_project.php?id='.$project['id'], false); } else { $session->msg('d',' Error adding receipt!'); redirect('edit_project.php?id='.$project['id'], false); } } This works but always show the active defined nav-pill. Not sure how to redirect to a specific nav-pill. Are there any good examples to accomplish the desired effect? Trying to to refresh or redirect to the currently displayed view. Rod
  11. Thanks everyone, I found the problem. Typo in first line of comments of js file, missing '/';
  12. I am trying to hide and show fields based on the value of the "age" field. The idea is when the user selects an age of less than 13 then the "parentPermission" fields will display and will hide if age is 13 or above. I just noticed that I attached the wrong "showhide" file. The correct one is listed here. =================================== ** * File: js/showhide.js * Author: design1online.com, LLC * Purpose: toggle the visibility of fields depending on the value of another field **/ $(document).ready(function() { toggleFields(); //call this first so we start out with the correct visibility depending on the selected form values //this will call our toggleFields function every time the selection value of our underAge field changes $("#age").change(function() { toggleFields(); }); }); //this toggles the visibility of our parent permission fields depending on the current selected value of the underAge field function toggleFields() { if ($("#age").val() < 13) $("#parentPermission").show(); else $("#parentPermission").hide(); } ===================================== I am trying this code as a test for experimenting prior to trying the same approach in my main application. The main app will not use age put using an "id" field to determine what additional information is needed from the user. Thought it would be better to put js script in separate files that would be included in the header or footer php files. Rod
  13. I am new at using javascript files. Currently I am trying to test a concept but can not seem to get the system to call the jscript functions. Attached is the main PHP file (Test Hide/Show Fields) and the js file (showhide.js). If I embed the js file in the main php things appear to work but when separate they don't. The extension of js file has been changed to txt to allow upload. TestHideShow.php showhide.txt any suggestions would be greatly appreciated. Rod
  14. Thanks for the reply. I am using notepad++ but get confused with the left bar indicating the start and stop of a segment. Went thru code and laid it out with consistent tabs which helps ( but the red line on the left does not match. WIll not rely on it in the future.
  15. I am building a page that has multiple tabs for entering data about a person/employee. Currently I am using 4 tabs(pills) which for the most part appears to work with a small issue. When the page is initially displayed the personal data page, everything looks correct. When the Social Media tab is selected the personal data screen is cleared and the social data is displayed. However, when the Tasks page is displayed it is displayed below the page (either Personal data or Social Media) the is currently displayed. Can not seem to locate why the screens are not cleared and only showing the selected page. Another minor issue if close the container (line 89 ) at line 96 the display is full width; however, if closed at the end of the tab-content section the display is narrow. Any suggestions would be greatly appreciated. Rod edit_person-new.php
  16. I have a form that is built, I thought like the those but does not display (display an error message generated on second pass of retrieving the passed parameters). On the initial pass from calling form, variables appear correctly. However, on the second call (pretty sure it is the form method line does not pass the variable. <?php require_once('includes/load.php'); if (!$session->isUserLoggedIn(true)) { redirect('index.php', false);} ?> <?php $person = find_by_people_id((int)$_GET['id']); error_log("all person id = " . $person['id'] . "\n",3, "./my-errors.txt"); error_log("all persons = " . $person . "\n",3, "./my-errors.txt"); $all_cats = all_people_categories(); error_log("person id = " . $person['id'] . "\n",3, "./my-errors.txt"); $query = "select * from people where id = '{$person['id']}'"; $result = mysqli_query($con, $query); $data = mysqli_fetch_row($result); error_log("lname = " . $data[1] . "\n",3, "./my-errors.txt"); if(!$person){ $session->msg("d","Missing person id."); redirect('people.php'); } ?> <?php include_once('layouts/header.php'); ?> <div class="row"> <div class="col-md-12"><p class="title"><span class="red"><?php echo $person['lastname'] . ", " . $person['firstname']; ?></span></p></div> </div> <div class="row"> <div class="col-md-12"><p class="title">Edit Person</p></div> </div> <div class="padding-top"> <div class="box"> <div class="row"> <div class="col-md-6"> <?php echo display_msg($msg); ?> </div> <form method="post" action="edit_person.php?id=<?php echo (int)$person['id']; ?>" > <div class="row"> <div class="col-xs-3"> <div class="form-group"> <div class="input-group"> <span class="input-group-addon"> <i class="glyphicon glyphicon-th-large"></i> </span> <input type="text" class="form-control" name="person-lname" value="<?php echo remove_junk($person['lastname']);?>" > <span class="input-group-addon">Last name</span> </div> </div> </div> <div class="col-xs-3"> <div class="form-group"> <div class="input-group"> <span class="input-group-addon"> <i class="glyphicon glyphicon-th-large"></i> </span> <input type="text" class="form-control" name="person-fname" value="<?php echo remove_junk($person['firstname']);?>"> <span class="input-group-addon">First name</span> </div> </div> </div> <div class="col-xs-3"> <div class="form-group"> <div class="input-group"> <span class="input-group-addon"> <i class="glyphicon glyphicon-th-large"></i> </span> <?php foreach ($all_cats as $cat): ?> <?php if($person['cat_id'] == $cat['id']): ?> <?php echo remove_junk($cat['descrip']); endif ?> <?php endforeach; ?> <input type="text" class="form-control" name="person-cat" value="<?php echo remove_junk($cat['id']);?>"> <span class="input-group-addon">Category</span> </div> </div> </div> </div> </form> </div> </div> </div> <?php include_once('layouts/footer.php'); ?> Can not see why the variable is missing. The function "find_by_people_id" is below: function find_by_people_id($id){ global $con; $p_id = (int)$id; $sql = " SELECT * FROM people WHERE id = '{$id}'"; $row = mysqli_query($con,$sql); check_query($row); if($result = mysqli_fetch_assoc($row)){ return $result; } else { return null; } } Thanks for any help. Rod
  17. I am trying to update multiple tables in the most efficient method. After trying each not sure which is best, issue is trapping errors in each situation. Using separate queries easiest to set up error trapping. Have tried mysqli_multi_query but can seem to get error trapping to work properly. And the method of using a single query to update multiple tables at once has worked yet. Anyone have any suggestions on trapping the error messages in mysqli_multi_query (have looked at examples) but don't seem to make a lot sense. Following is a code segment: $query = "UPDATE projects SET"; $query .=" name ='{$p_name}', date_open ='{$p_open}',"; $query .=" date_closed ='{$p_closed}'"; $query .=" WHERE id ={$project['id']};"; $query .= " UPDATE proj_text SET"; $query .=" descrip ='{$p_text}'"; $query .=" WHERE proj_id ={$project['id']};"; $result = mysqli_multi_query($con, $query); do { /* store first result set */ error_log("store = " . mysqli_store_result($con) . "\n",3, "./my-errors.txt"); $err_num = mysqli_errno($con); error_log("error = " . $err_num . "\n",3, "./my-errors.txt"); if ($res = mysqli_store_result($con)) { while ($row = mysqli_fetch_row($res)) { error_log("row = " . $row[0] . "\n",3, "./my-errors.txt"); } mysqli_free_result($res); } /* print divider */ if (mysqli_more_results($con)) { error_log("more row = ---------------------\n",3, "./my-errors.txt"); } else { break; } } while (mysqli_next_result($con)); when data is entered in only the second portion, the results are store = error = 0 more row = --------------------- store = error = 0 when data is enteed in the first portion, the results are: store = error = 0 more row = --------------------- store = error = 0 Not sure if I am looking at the right data to determine if error occur of if there is a better approach. Rod
  18. The error I get is as follows: query = UPDATE activities SET (completed = 2015-09-03) WHERE (id = 2); error = You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '(completed = 2015-09-03) WHERE (id = 2)' at line 1 --------------------------- I am not sure how to build the query by storing the pairs in an array. Is there a tutorial or example I can study? Also the other remark about update queries doing data checking is good to know, I don't that happens in other database systems I have used.
  19. I haved this $query = "UPDATE activities SET (completed = '{$p_done}') where (id = {$activity['id']});" which gives $query = "UPDATE activities SET (completed = '2015-09-03") where (id = 2); but get the same result. should this be $query = "UPDATE activities SET completed = " . '{$p_done} ' . "where (id = {$activity['id']});"
  20. I am building an UPDATE query but having an issue when updating date fields. The date fields are 'due_date' and 'completed'. The fields are populated by date_picker which uses format YYYY-MM-DD. When a query is built it has the following form: $query = "UPDATE activities SET (completed = {$p_done}) where (id = {$activity['id']});" when substitutions are made $query = "UPDATE activities SET (completed = 2015-09-03) where (id = 2); error generated syntax error within the following: SET(completed= 2015-09-03) where (id=2) Updates work with other fields when dates are not being updated. The code segment is attached. any ideas? Rod new 2.txt
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.