Jump to content
Larry Ullman's Book Forums

chop

Members
  • Posts

    192
  • Joined

  • Last visited

  • Days Won

    5

Everything posted by chop

  1. Once you really understand what the client wants, you can come up with an estimate as to the total number of hours it will take you to complete. Don't make the mistake of getting into a job in which you don't have a complete understanding as to its scope. Otherwise your hours estimate will be way off and you'll be faced with charging the client much more than the estimate or feeling like you were underpaid. So.... WRITE a document that explains exactly what you're going to do based on what the client has expressed they want verbally. Keep in mind that often even the client doesn't know exactly what he wants. So feel free to add in your own suggestions as you do a little market research of other similar sites. GIVE the document to the client. TALK to the client about all the aspects of it. REVISE it as you discuss it until you both have a solid, clear understanding of it. This will prevent other "things" from being thrown into the mix because the client thought they were included from the start. Big jobs often involve a lot of research of what is needed before anything can begin. IT IS OKAY to bill your client for this time but it should be done on an hourly bases and the bill should be separate from the bill for the website. The written document that you share with your client might be called a contract, a specification, or a proposal but it should be absolutely clear to both parties before you drive the first nail (including the time line). The exactness of it will make it easy for you to estimate your hours which can be multiplied by what you feel you need to make without you or the client feeling cheated. Make sure that you include any expenses you might incur such as purchase of images etc..This is most important. If the client likes this document then you send a bill for your time, you get paid, and everyone's happy. I would ask for a retainer of 50% due fairly early in the project in case you do lots of work and the client bails. How closely you follow this procedure depends on how big the project is. I have had people I know come to me wanting a simple one page site, plain vanilla, and know exactly what they want on it. They just want something for a web presence. I might say, okay, that will cost you $x so please send a check and it will be up in 2 days. Less time involved, less risk, less money so less need for paperwork. Think also about where you will host it and if you want to charge the client for annual hosting with a little added on for your occasional support. You can get a discount as a reseller on a host, say $50 and charge the client $99/year. good luck, chop
  2. For me, yours worked fine and is simpler. The input csv strings I use are not input by users so are controlled never to include anything unexpected. chop
  3. Yes, right again HartleySan. I went to the php.net site to look for code to replace the unavailable "str_getcsv()" and there were many scripts like the one I was using (and not working correctly). So, I figured it couldn't be that simple and didn't know about explode. The posts are fairly recent and there's no use of explode. My only guess is that the ones provided are supposed to do more than the simple explode. If you want to take a look at what I'm talking about, here's the link. I'd like to understand it. http://www.php.net/manual/en/function.str-getcsv.php thanks for the simple solution chop
  4. I found that if I make this change: substr($input,0,-1) from the original substr($input,1,-1) it only chops off the very last character.. thought I had it but I've tried numerous combination in a hit-or-miss fashion and I can't get that last character. I could cheat and save the last char. before sending it to the function -but that's cheating
  5. Okay, I found this and tried it. It almost works but the first and the last character of the csv has been chopped off. function csv2array($input,$delimiter=',',$enclosure='',$escape='\\'){ $fields=explode($enclosure.$delimiter.$enclosure,substr($input,1,-1)); foreach ($fields as $key=>$value) $fields[$key]=str_replace($escape.$enclosure,$enclosure,$value); return($fields); } // I eliminated the single quote enclosure argument in the above example Any clue on what might be causing the truncation?
  6. I was using " str_getcsv($keyDescriptor, ",") " locally and it working fine. When I put it on a remote server I get an error that the function is not defined. Is there another function that will do the same thing? Or do I have to write one myself using a regex? thanks, chop
  7. Yes, I understand. I just removed the "$kount" subscript from my code (above) and it worked fine without it as it did with it. thanks for helping
  8. Thanks. I see what you mean about the counter index. Every once in a while I have flashbacks to my Basic or Pascal days. Although, wouldn't it be nice to be able to say something like: $shortDescription_array[]= mysqli_fetch_array ($r, MYSQLI_NUM) ?? chop
  9. I thought there was a more direct way of doing this. I want to put the results of the query into the array "$itemDivs_array". Do I need to loop through like this? $q = "SELECT DISTINCT itemDivisionName from luItemTypes"; $r = mysqli_query ($dbc, $q) or trigger_error("Query: $q\n<br />MySQL Error: " . mysqli_error($dbc)); echo "the number of rows is ".mysqli_num_rows($r)."<br />"; $kount = 0; while ($row = mysqli_fetch_array ($r, MYSQLI_ASSOC)) { echo $row['itemDivisionName'].", "; $itemDivs_array[$kount]=$row['itemDivisionName']; $kount += 1; } mysqli_close($dbc); thank you, chop
  10. I think I do need the js because... scenario: A user that has a "business" account want to edit the information. The form's "personal" and "business" radio button set defaults to "personal" (90% of users are personal accts.) In addition, the form fields that relate to "business" are hidden by default. SO the js needs to check the "business" radio and set the business related fields to "block" from "none". There are other similar situations. I appreciate the code, HartleySan, and will print it out and study it over a cup of coffee. I always enjoy learning new techniques, especially when I have the opportunity to actually use them for a project. Jonathon: will get the firefox plugin.. why not? Great to have this forum! thanks, Chop
  11. Thanks Stuart, "session_save_path($path_to_folder);" is something I'd like to add. Can you give me more specific instructions as to where I'd locate this code? thanks, Chop
  12. I need js because this is a page where the user calls up their previously entered personal data from mysql and can then edit it. So, if someone has created a "business" account, the "business" radio would be selected in advance and the extra input fields that relate to a business account would become visible via the "block" or "none" showing or hiding the div. Your including a "document.getElementById('pm')" (i forgot to include the ('pm') in this example) does work but the "javascript.document.editRegistration.pay_method[1].checked=true;" can work by naming the form "editRegistration" and the rb group name where the [1] index refers to the second button in the group. It worked at some point (unless I just dreamed that it did). However, putting an id="xxx" in the form's button makes it easier than using an index number. I'm obviously not that familiar with js but needed to use just a little of it for this project in the way I have described. So, my js style is a little off for sure. I just need to get it working for a deadline even if it's not pretty. Then, I'd like to go back when I have more time and learn how to separate out the js like you say it should be (HartleySan). It doesn't seem odd to me though to mix in the js. That's probably because there's so much mixing php in with the html (as in Larry's books) that I see it as an accepted technique. But again that's probably because i don't know much about js which is different than php. Firebug: (Stuart) I have Dreamweaver for my editing which is okay with the php. If I start having to use a whole lot of js, I'll consider getting a better editor. thanks so much for your help. Chop
  13. Okay, thanks. I'll read up on what makes a secure session as opposed to a non-secure session (I actually thought that sessions were secure by default but I'm still in the early stages of learning about server security). thanks for your help, Chop
  14. This was working a few days ago (I swear) but something's gone amok. The first js statement works okay but I can't get the second one to select the second, of the two, radio buttons: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <title>Untitled Document</title> </head> <body> <form action="" method="post" id="editRegistration" name="editRegistration"> <div id="pmradios" style="display:block;"> <p><b>I WANT TO GET PAID FOR MY SOLD ITEMS:</b> <input type="radio" name="pay_method" checked= "checked" value="card" onclick="javascript:document.getElementById('pm').style.display='none';" /> <b>by card.</b> <input type="radio" name="pay_method" value="check" onclick="javascript:document.getElementById('pm').style.display='block';" /><b>by check (enter your address).</b></p></div> </div> </form> <script language="javascript"> javascript:document.getElementById('pmradios').style.display='block'; javascript.document.editRegistration.pay_method[1].checked=true; </script> </body> </html> thank you, chop
  15. There are several places in the program where users might be changing their personal db information. Though they are already logged in, I ask them for their password just before they "submit" their edited information (in case they walked away from their computer while logged in and some lowly character walks by). To query the db each time just before posting their data seems more complicated than simply comparing their "confirming password" (that is the last field in the "update" form) with the $_session password that is being toted around from page to page. Make sense? thanks, chop
  16. Well, I wanted to compare the pw in the database to the one just entered by the user. So I could actually compare the two hashes of each password. So I would be carrying around just the hash of the original password. That would be okay wouldn't it?
  17. Is it safe to carry around a user's password, from page to page, in a session variable? thanks
  18. well, you got me thinking in a different way. this is what I came up with that seems to work and is much simpler. No need even for a hidden field. thanks, Chop -----all other form fields here--- <?php if (isset($_POST['acct_type']) && $_POST['acct_type']=="business") { ?> <script language="javascript">javascript:document.getElementById('pb').style.display='block'; </script>// displays business related form elements <?php }?> </fieldset> </form>
  19. I want to add a conditional statement to the form action such that a value will be sent if true and not be sent if not true. It looks like this so far (this doesn't send the value): <?php if (isset($_POST['acct_type']) && $_POST['acct_type']=="business") { echo '<form action=register.php?business=true method="post" id="register">'; }else { echo '<form action=register.php method="post" id="register">'; } ?> I'm not even sure if this is the best way to accomplish this! if the "acct_type" = "business" AND the form doesn't validate, the form will be shown again with the form input elements that need to be filled in. This is the js that will do that: if (isset($_GET['business'])) { // will be false if ?business=true is not sent with the register.php URL ?> <script language="javascript">javascript:document.getElementById('pb').style.display='block'; </script> //will show the form elements <?php HERE ARE THE RADIO BUTTONS THAT SET THE "acct_type": <!-- PERSONAL OR BUSINESS ACCOUNT 'acct_type'personal,business --> <p><b>TYPE OF ACCOUNT:</b> <input type="radio" name="acct_type" checked= "checked" value="personal" onclick="javascript:document.getElementById('pb').style.display='none';" /><b>personal.</b> <input type="radio" name="acct_type" value="business" onclick="javascript:document.getElementById('pb').style.display='block';" /><b>business (enter business address).</b></p> thanks in advance Chop
  20. Thank you both for your help. It works perfectly! Being a php programmer, the mixing of code with html is familiar to me so I don't mind Paul's method and ended up using it. Also, there isn't that much "conditional" input that I need. Though, when I have time, I'd like to explore the method of separating the js code as suggested by HartleySan. Great to have these forums. What a life saver. thanks again, Chop
  21. Well, I'm struggling a bit because I don't know squat about js, really. This is where I am, maybe you can advise: <p id="demo">'<div style="display:block">' </p> <script type="text/javascript"> document.getElementById("demo").innerHTML='<div style="display:none">'; </script> Can you send me an example? thanks
  22. Well, I'm struggling a bit because I don't know squat about js, really. This is where I am, maybe you can advise: <p id="demo">'<div style="display:block">' </p> <script type="text/javascript"> document.getElementById("demo").innerHTML='<div style="display:none">'; </script> thanks
×
×
  • Create New...