-
Posts
6,906 -
Joined
-
Last visited
-
Days Won
99
Everything posted by ginerjm
-
Forgive me this change of topic, but why on earth would anyone want to provide universal access to the entire root folder(and therefore its subs) of one's site? I can see providing access to a subset of folder(s) that contain documents or images or some collection of files, but the whole site? Perhaps the easy way to prevent your problem would be to just supply a list of eligible folders displayed in some visually-appealing format and let people click on the name they wish to see? That is, if you don't have second thoughts about the whole idea.
-
Way too many errors in this code to even try to understand. Why do you even attempt to pass that frm1 thing as a constant to the js function when in the js you don't even try to use the supposed-passed-in argument? Why do you use a td to encase both a span and a div just to apply styles when you could just do it to the td tag itself? so much work to do...... One suggestion - work on separating your html from your logic. One is just that logic - the other is presentation. Don't mix the two except where necessary.
-
Would be real nice IF YOU HAD shown us the error instead of making us digest your entire code. Could it be because you didn't quote it properly?
-
Cookie not working properly inside popup window
ginerjm replied to miguelfsf's topic in PHP Coding Help
C'mon. Really? You expect us to debug your code with such a small sample of WHAT? None of this makes sense to us. One hint. You do realize that a cookie is not readable (after being set) until the page is refreshed, ie reloaded, right? So if you are setting is at the top of a script and then trying to read it a second later you're not going to see it. -
The message indicates that the query failed. You didn't get back a 'resource' as expected, you got instead a value of False(ie, a Boolean). This would have been detected had you done the proper thing and tested the results before blindly trying to fetch the results.
-
First on the list: Please post your code properly for this forum (and any others you use). Here it is square brackets surrounding 'code' and '/code' to open and close the code block. One thing to do would be to move into the current decade and stop using the MySQL_* functions. Check the manual. They are marked in RED - Do Not Use You should use label tags. Look them up. Currently (using deprecated escape function) you do an escape on an input but then you go and display it to the client. Bad. You s/b prepping those fields for safe display, not for safe usage in a query. Read up on htmlspecialchars function. Besides - if your escape function puts a slash in a var, do you really want to echo that back to the user? PLUS - do you really want to pass the password back over the net to the user??? Also - I don't see a field for State or Province in your address fields. That leaves out the US and Canada and probably many other users. On the plus side - glad to see that you (unlike many other new users) avoided the pitfall of placing style attributes in every single one of your inputs. Good to see. Of course I do hope you will be using some CSS to style these later. One thing you might want to consider is adding value clauses with php vars in them so that you can re-send the form and the user's inputs back to him/her in the case of errors. Otherwise they will have to re-enter the entire form. This would of course mean that you should probably separate the password function to another screen so that you Don't send it back. Keep on trucking!
-
How to save three variables from different queries
ginerjm replied to Cyjm1120's topic in PHP Coding Help
The first option - a hidden field - is nothing more than adding one of these to your next form before output: <input type='hidden' name='field1' value='$field1'> Then when your second form is subtmitted and you receive the POST vars, you will have a $_POST['field1'] in it. Then you send that back out with the field you are getting in your second form, both to the third form. -
<?php ... ?> several times in DIVs or just print it all using php?
ginerjm replied to appobs's topic in PHP Coding Help
By using php includes you do standardize your scripts and your html pages since you will be using the same code in all places. As long as the html code in those included files is well-written I suppose you could say you are standardizing. -
How to save three variables from different queries
ginerjm replied to Cyjm1120's topic in PHP Coding Help
Just taking a shot at what I think you are doing. Form 1 is displayed and submitted and you grab the first value. Then I assume that you generate a new form and the same process happens and you grab the second value, but lose the first. 1 - you could save the first value as a hidden form field in the second form and then retrieve both when the second form is submitted. 2 - OR you could save each form value as a $_SESSION variable and when all 3 forms are done you will have 3 session vars to use at the end. -
<?php ... ?> several times in DIVs or just print it all using php?
ginerjm replied to appobs's topic in PHP Coding Help
To add to your last statement - Aren't you using php in order to provide content to your web page, aka html? You're not standardizing your html - you are providing data to output in html. -
Rather than attempt to diagnose your code I just want to say: 1 you can't use both GET and POST in one 'submit' Whatever you placed in your form tag is what you're going to get. 2 - Your latest post - is that supposed to be the long-sought question I asked for? What do you mean by remember? Remember for the next submission or remember for the next 10 years? Makes a difference. If you mean the next submissions then how about storing the values (once you get them) in the $_SESSION array? That way you have them for the life of your session. Or you could just send them back out to your form the next time you output it as hidden vars which will then come back to you as POST or GET vars on the next submit. As for saving them for 10 years or whatever, try a db save. Also - read thru your code your code and ask yourself "what am I doing with these lines" at each point in your process as well as "does it make sense to be doing this here and now". You need to get a handle on what your script s/b doing when it starts up and at various points in the process.
-
Did YOU create this code? Or did you foolishly copy it from somewhere without doing any learning first? Either way - obviously your attempt to call that function (chn) needs to be corrected. Either find out (from your code sourcer?) what the function does and replicate it, or dump it and read up on how to establish a db connection. I suggest reading and learning since that can only HELP you in the long run.
-
We usually help those who help themselves. That means if you want to be a programmer, act like one and learn how to at least attempt to write code. Tough words but we're not here to do your bidding. We're here to help people who are making an attempt to become programmers. Now that I've vented on you - there is another forum for people looking to hire help. Perhaps you want to post there.
-
I have no idea what you want from us. But I will comment. 1 - I hate when people post pieces of code in separate blocks. We can't see how these pieces connect; we can't see what order they are in; we can't see if one corrupts the other. And you dont' tell us how they interact. 2 - I hate when people don't see the obvious. In your case you have some code that is grabbing two inputs. Then you have (apparently) some code to display an INCOMPLETE(?) html table to grab these inputs. THEN you have some code that grabs these same two inputs again. Uhhh - is there a problem here? 3 - Most of all I hate when posters don't ask a clear question. We have no idea what you are doing. Could you spare some time and write a complete (brief?) description of your problem/question instead of making 3 numbered statements and leaving us hanging? PS - if I am assuming correctly ( and I hate to assume) it is not a good idea ever to be combining separate pieces of incoming data into one column of a table. If the data IS separate, why would you want to join it together?
-
Not only are you new to php you apparently are new to computers. You really need to read some books and learn about directory structures, relative and absolute paths, variables, programming in general and how it all works - regardless of the language. You're trying to become a programmer. Therefore you have to walk before you run. Try writing your very first script/program as something simple. Design a simple form to enter your name and phone number and then a php script that displays that form and then processes the result of when you click on the form's Submit button. That will grab those inputs and re-display them for you. You will learn some of the most basic processes that you will ever do with the web and php in this fashion. This is going to take some time and effort on your part both to understand the interactions between the browser (client) and the server (php) and how one feeds the other and then handles the returned data later. Good programmers are well-trained individuals who have done their homework and made the effort to learn before doing. It is very possible to do this by yourself, but you have to do it. You can't just copy some stuff that purports to do what you have in mind and then seek help when it doesn't work. You have to write some code and learn how it works or doesn't work and fix it - albeit with some help. We can sit here and tell you all kinds of things that are wrong with the code you didn't write but what will that tell you if you don't understand what we say? As for your current example - forms don't have document attachments. Emails do though. Terminology is very important in the IT world. That said, it sounds like you want a form that "uploads a file" - that is handled with a special html input tag - " type='file' ". Look it up and read about it AFTER you have done the baby steps I mentioned above. Good luck and happy learning!
-
What I asked you to do was to go thru your code yourself and narrate what you had programmed it to do so that YOU could see what a mish-mosh of stuff you were doing in incorrect sequence. That way you could correct the flow so that it made sense and might even work. As for what is wrong - the only thing you have clearly stated is that it 'opens window after window'. You have already been told that PHP Can't Do That. Obviously you must have either: a) if this action happens repeatedly without your intereaction then you have some JS code running away. Remove it/Comment it out. or b) if this happens every time you hit a submit button then your form is targeted for a new window (not recommended) and that is why you are getting multiple windows. OR is there something else wrong?
-
How to get count comments for multiple comments page
ginerjm replied to Gemafernandez78's topic in Javascript Help
Perhaps I'm reading this wrong, but I don't see any PHP code in this problem. Maybe you want to post this to the correct forum? -
You are looping thru the entire POST array, not just the checkboxes array. Assuming that your html name field for the checkboxes is "cbox[]" this is all the code you need to list the checkboxes that are checked: $ans = ''; foreach ($_POST['cbox'] as $cb_value) $ans .= $cb_value .'<br>'; echo $ans;
-
Sorry - but your log entries don't tell me anything. Do you mind telling us what is wrong? Of course I still don't see how this script could ever run but you could tell us what it does do for you
-
No. I wouldn't build a search in the construct. The construct should just create the object then you would use other methods to retrieve data or to add/insert data. How could you do a search for a customer in the construct if you are creating that customer?? You could do a construct in the search method but not the reverse. As for the alternate search method - the array would be an array of items to be used in the search - say 'city' and 'last name' - to build the query's where clause. The results of this query would be either the resource that was returned or an array of customer objects. Personally I think returning the query results would be better and then you let the caller handle it as it wishes.
-
What does the customer class represent? To me it would be something that manages the data about a customer - name, address, id - things like that. You want a search function. Is the search always on the same argument or is it a more general search ? You might have a method in your class that always allows you to retrieve a specific customer given his 'key' field. And you might have another method that searches on a more general sense that may use an associative array argument that you can then use to build a search query. Yes - these two methods would be part your class.
-
This is your FIRST script? Kinda complex isn't it? And you wrote it? Can you assemble these pieces of code in the correct order and look at them with a questioning eye? If what you have posted runs in the order it shows here then you db connect will never connect. Just look at it and read it out loud to yourself and you'll begin to see the logical errors. For ex. you begin by outputting a form and then you make 3 function calls using vars that have not been defined and assign the returned values to 3 other vars that will of course also be undefined. Then you attempt to make a connection with undefined values. That is what I mean. You need to look at the flow of your code and put things in order. PS - it is not a good idea to be mixing presentation (html stuff) in with the logic stuff (php). Do the php stuff first to prepare your eventual output and THEN do the outputting of your html and the dynamic data that your php has gathered for you.
-
Remove the $I. You're not setting so why use it in a loop?
-
Excellent point 7blake! A great teaching moment.
-
So you are writing a script that puts out a "bare" html page? No headers, no meta, no scripts, no css styling?