-
Posts
14,780 -
Joined
-
Last visited
-
Days Won
43
Everything posted by .josh
-
wow! This place is incredible!
.josh replied to onedumbcoder's topic in PHPFreaks.com Website Feedback
oh...I thought it was because of the handcuffs... -
Looks like you need to find where $val is being set, and change that from 0 to 10. But this smells like 3rd party code to me, so I am moving it there. I suggest you respond by posting what 3rd party script you're using, cross your fingers and hope someone knows about it there...or go to their support forum.
-
First thing I notice is $usrnm = $_post["username"]; $usrnm = @strip_tags(stripslashes($login)); perhaps you meant to put $usrnm instead of $login? If that doesn't do it, then lemme know.
-
Not 100% but I think that <br/> might have something to do with it. If you practiced better code spacing/indenting it would be 100% easier to find bugs like this... p.s.- If that doesn't fix it, then you're going to have to show more code. Like, the loop.
-
Instead of having your page link creation loop count from 1 to $total_pages, have it count from a range, relative to the current page. $range = 5; // number of pages to have before current and after current for ($p = ($current_page - $range); $p <= ($current_page + $range); $p++) { ... } You are going to have to put a condition inside that loop to check if $p is below or above the min or max, of course. If it is, then don't display the link, so it creates 1 2 3 4 5 6 7 8 9 instead of -1 0 1 2 3 4 5 6 7 8 9 As far as the << and >> part: You would add a condition to check if your << marker isn't below or above min or max page. If it's not, you display it. The << would go before the loop, the >> after the loop.
-
I think you are absolutely right, thosecars. It would be horrible design. I offered an alternative to using javascript, because you're looking for alternatives. That's really about the only thing you can do, as far as changing it on the fly like that, using just php. Honestly, I'd advise you to go the javascript route. Yes, there are *some* people that still have js disabled on their pcs, but they are so few and far between these days in the world of ajax and "web 2.0" that you should probably sit down and think about whether those very few paranoids out there would really hurt your business/org/whatever, by not being able to change languages on the fly and yet keep their text area info. My opinion is that you're designing a feature here. A feature, not an integral part of your system. I really don't think it's that big a deal to have the javascript. I personally think that under (most) normal circumstances, people would go to your site, and clicking the language of their choice would be the first thing they do. I really don't see a whole lot of people suddenly deciding to switch from English to French in the middle of their surfing while they are filling out a contact form. My 2 Cents.
-
How to display text dynamically on HTML depending on radio button
.josh replied to jwhite68's topic in PHP Coding Help
I'm sorry, but we aren't really here to write your code for you. Making a submit button is basic html. Making a condition to check which button was pushed is basic php. If you do not know how to do those things, then...no offense, but I have to say that I think you're putting the cart before the horse. Even if I were to write the code out for you, you wouldn't understand it, and you wouldn't be able to really add to it/alter it etc... I suggest that you search for some beginner php and html tutorials (the proverbial "hello world" ones), or if you really aren't interested in getting your hands dirty, hire a freelancer. Again, I'm not trying to be mean here; just looking at it objectively and honestly. If you wish to go read some tutorials and you're fiddling with your code and you're having trouble with something, we're more than happy to help you fix your bugs. But we aren't here to do your work for you (for free, lol). Well, maybe someone out there is more generous than I. -
Yes it is possible, and fairly easy to do. Is there a better way? Depends on what this is for. If you are wanting to go the route of "London" not existing until someone enters it in, you're going to have to deal with issues like people misspelling it (london, Lndn, londn, LongDong, etc..). Do you plan on being able to search for people by city? Sending packages to people in the mail, or billing them? If not, then that's not really that big a deal. But you did mention you wanted it to be added to your existing dropdown, so it is some kind of deal. Overall, I'd agree with phpknight's suggestion: go find a database/text file of cities/states/countries/etc...
-
How to display text dynamically on HTML depending on radio button
.josh replied to jwhite68's topic in PHP Coding Help
Well first off, it depends on which route you want to go: strictly PHP, ajax, or javascript? If you're going the PHP route, you need to change your radio inputs to submit inputs, assign unique name/values to them, and make a condition at the top of your script to check which one was pushed, and dynamically display (or not display) your price. If you're wanting to go the ajax or javascript route...well, I'm not an ajax or javascript dude; you'd probably find better help going to one of those forums. -
You're still out of luck, unless you are able to dynamically change that link. As in, the refering site has to request a dynamic link from your site, and you have script to generate it, which you'd include the token in it.
-
I'm not anywhere expert in mysql but I suppose you could like, go into phpmyadmin and get the db to dump the query that creates the table (with the defaults), then in your reset script, you could like, drop the table and recreate it with that query. I'm going to move your thread over to the sql section they would know if there's a better alternative.
-
How to display text dynamically on HTML depending on radio button
.josh replied to jwhite68's topic in PHP Coding Help
You can setup a condition to check which button was pressed, but PHP is a server side language. Each button would have to be a submit button, and the user would have to press the button, and the client would make another request to the server. In other words, the page would have to be reloaded every single time. It's more secure, if that's what you need, but if security is not all that important (as in, you're not gonna lose sleep over whether some dude rightclick > source's it to see the price, the more efficient method would be to do this with javascript. Or you could mix it up with ajax. It's a middle road in that you use javascript to handle the event (the clicking) and it makes a (smaller) request to the server for the price. That way, the user cannot right click > source for the price..but it's not as secure as straight php because ajax can be disabled just like javascript, making your page unworkable. -
If you have no control over the refering site, then I'm afraid you're out of luck; that's the only thing offered. Your only consolation is that even though it's fairly easy to spoof (all you really have to do is edit a file on your computer), most people barely know how to turn on their computer. Now, if you DO have control over the refering sites (as in, you can insist certain pieces of code be transmitted from them, look into token passing.
-
Make a script to update your table, in it's own file. Setup a cron job to run it every x time/day that you want it. If you do not have the server access to start a cron job, you're going to have to basically make a script that's called on every page load to check the date/time and run it if it's the appropriate date/time. This isn't as accurate though, as it is dependent on pages being requested by people. Also it uses more resources and generally slows down everything.
-
you could make your language link a submit button instead and have the text area carry over as a posted value. setup a condition in your script to check whether it was the language "post" button pushed or the real submit button.
-
so..are you asking how to setup sub-categories in your database? write code to show drop downs? You're being kind of vague.
-
repost your code as it stands right now with the changes
-
okay, so on paper (not in the code, but rather, what you expect it to do) what is the difference between clicking on the first page and clicking on page 2,3, 4, ...? Because I'm still kind of leaning towards that if statement not really being necessary, for what your trying to say. That is, according to my best interpretation of what you're saying, you should get rid of the if...else statement and 2nd query altogether and just use the first query straight up.... ...unless there was some reason you needed to check whether the person was on page 1 or not (other than say, the pagination link generation part, where you have to figure out if user is on page one, don't generate a page 0 link, sort of thing). So, back to my first question: why is this if..else statement here? What's the plan for it on paper?
-
pagination is the act of breaking down a list into separate pages. Yes, it is most commonly used with databases, but it doesn't matter where the data comes from. Glad you got it all sorted out.
-
umm..well, if you are wanting the query in the if $SearchSelect == 1 to be ran every single time, then...remove the condition altogether, and just have it run every time? I'm going to assume that's not what you're asking though, as that's kind of a given...so I guess if you could rephrase and/or be more specific, I'll take another stab at it.
-
I'm not seeing where $searchselect is being defined, so it's always going to execute the query in the else statement. Also, where is your query that actually pulls the 10 rows?
-
How is this thread any different from the other one you posted earlier asking for pretty much the same help? I'm going to assume since your other thread was marked as solved, that this is a different problem, but it's the same kind of problem. I'm moving it to where I moved your other one, I have noted your apology for posting in the wrong place, but come on, we've already been through this...
-
so...you're saying that not a single piece of that code works? What have you done to try and fix it, other than just post it here and hope for a magic wand to be waved? What have you done for debugging? Have you inserted echoes inside your conditions to see if they are ever being met? Have you echoed variables to see if they are being passed and/or are holding what you expect them to be holding? You need to tell us what you have done and what happened, because we obviously don't have access to your files/dbs/etc.. people offer some help and you respond by saying "it" doesn't work. Well, what didn't work about it? Start over from square one, checking the variables, etc.. because that magic wand just doesn't exist. I'm not trying to be an arse, but you can't just post code and say "It doesn't work, fix it."
-
Can you please elaborate on that "It's not working" ? Because according to your code, if the session variable doesn't exits OR it does exist but (time-var) is more than 15..it just sets a session variable...and that's it. Is that the "it" you're trying to do, only it's not working, or is "it" something else?
-
whole sticky dedicated to this. thread closed.