-
Posts
1,216 -
Joined
-
Last visited
Everything posted by WebStyles
-
Creating a new php file from user submitted data
WebStyles replied to gengo's topic in PHP Coding Help
Basically, I pull out 50 random ids from the database and store them in a $_SESSION array, I use one at a time, removing it from the array once it's been used. This way they never repeat, and it's very easy to put them in the url. While the first video is being watched, I've already created the link for the second one, so that when someone pressed 'random', it's already in the url. -
Creating a new php file from user submitted data
WebStyles replied to gengo's topic in PHP Coding Help
I actually have a similar thing on my website that shows random videos, but I force a refresh when the random button is clicked so that I can put the video id in the url, making it 'bookmarkable' by anyone. -
Creating a new php file from user submitted data
WebStyles replied to gengo's topic in PHP Coding Help
From what I understand, you just want a way for users to be able to return to a post they liked, and since each post has a unique id, all you want to actually do is store those ids. Why not create a new table in your database, with just id, userName, pageId and simply let them 'bookmark' the stuff they like? of, store the last 40-50 topics per user in a session variable, so as long as they don't close the browser, they'll be able to navigate back to them. Dunno if this is what you're looking for. Hope it helps -
http://www.phpfreaks.com/forums/index.php?topic=326473.0
-
checkbox with multiple values processing into MySql
WebStyles replied to rilana's topic in PHP Coding Help
Sorry, but there's a big difference in helping solve the problem and actually doing the work for you. If you need someone to code it for you, I'm sure you can hire a professional freelancer or something. -
checkbox with multiple values processing into MySql
WebStyles replied to rilana's topic in PHP Coding Help
if $_POST['beruf'] is an array, you can loop through the values: foreach ($_POST['beruf'] as $k => $v){ $beruf = explode(",",$v); // do something with it before it gets overwritten by the next value // etc... } * please note there's a typo in my previous post.. $$ should only be $ -
change this: <a href="<?php echo sizeguide.php ?>"><?php echo $brand; ?> Size Guide</a> for this: <a href="sizeguide.php?brand=<?php echo $brand; ?>">Size Guide</a> then in sizeguide.php grab $_GET['brand'] and create a simple switch() or if() to show only relevant content.
-
how about subscribing people who have already voted to the forum, so they get a notification when a new solution is posted? That way they can go back and change their vote if the newer solution is better. This idea about 'voting' came to me, because there are many questions that have more than 1 solution (hell, in programming, there are normally many solutions to each problem)... or.. the votes could be categorized, like: simple solution, unsecure solution, secure solution, etc... (gotta think about this better) (sometimes, from a programming point of view, if I'm just doing script to test stuff for myself, I'm not really interested in security issues, as the links won't even be public, other times, security is my main concern.)
-
that's pretty easy. All you need to do is grab the brandname then... but if you don't know where it is stored, how are we supposed to know? you need to look at your database, find the name of the table and the field you need (or look at your code in that page, chances are it's already being retrieved) and just add it to the link in the form ?brandname=whteverBrandNameIs, then on your sizes page, just grab the variable, and display only relevant content.
-
cookies have the lifespan you configure (i.e. you choose how long they live). But a user's browser can also have cookies disabled, and you need to account for that. you probably have some code looking for a cookie, and redirecting if it does not find one, but you're redirecting to a page that does the same check, therefor you enter a non-stop loop. please post your code.
-
So you need code to fetch the brand name of the page and then pass it on? where are those brand names stored and how are you retrieving them?
-
depends on your point of view, but a person who has 2000 posts, (doesn't matter if they were questions or answers) MUST have learnt quite a lot, otherwise he (or she) is basically a complete moron. Or maybe just consider answers as valid posts counts... I'm just throwing ideas out, but as with any new feature/change, things have to be brainstormed until they end up making sense (or not)
-
Good point. Maybe restrict the voting to people who have a certain amount of posts (therefor more experience). or, in each post, a member can only vote on 1 answer, therefor if I voted A, but later decided B was a better option, I simply vote B and my previous vote gets transferred, and removed from A. Just a thought.
-
simple solution would be something like: (create dynamic links from database with the page names or ids) <a href="redirector.php?pageName=page1">page1</a> and use a little redirector file to check if the page exists before redirecting that will send them back if the page does not exist. But there are loads of security issues with something like this, because it will allow virtually anyone to write pagenames in the url to open up stuff they shouldn't have access to. either you put all the pages in a specific folder, and only allow them to see pages contained within that folder, or you need to set up a permissions system based on each user (I'm assuming they have to login, might not be the case).
-
Just a little suggestion: would be kind of cool to have a little 'I Agree' button under each post (kind of like what yahoo answers has with the voting system). Avoids a lot of unnecessary text and quickly lets the original posted know what the community's preferred answer is.
-
Pre-populate the selected item of dropdown box based on an ID
WebStyles replied to LondonChris's topic in PHP Coding Help
you can simply use trim() on all posted variables to avoid that problem. -
can you post your code please? (an example of this:) How is that name shown? is it a href link? (is the name in the url?)
-
Pre-populate the selected item of dropdown box based on an ID
WebStyles replied to LondonChris's topic in PHP Coding Help
Where's the value tag in your option? options in dropdowns have this format: <option value="something" selected>Something</option> you need to include it: <option <?php if(isset($SubChannel) && $SubChannel == "Wap"){echo ' value="wap" selected="selected"';} ?>>Wap</option> -
checkbox with multiple values processing into MySql
WebStyles replied to rilana's topic in PHP Coding Help
As I've said before... You are sending over an array like the one you printed: Array ( [0] => 4,9,10,11 ) LOOK AT IT. it's an array containing ONE value at index 0 (zero). The value is 4,9,10,11. if you want to seperate those values, you EXPLODE them (like I also said before). But you don't explode the whole array, because (like I also said before) explode() created an array from a string. exploding an array is just silly. You explode the variable you actually want, which in this case is index 0 of the array: $beruf = explode(",",$$_POST['beruf'][0]); -
$ad and $location don't exist, to this: empty($ad) || empty($location) will throw the error
-
PHP = server side language (executed on server before page is delivered to client) javascript = client side language (executed after client receives page) When you see the confirm box, your records are already deleted. (you can check this by submitting the form, then checking directly in database before you click on 'confirm' or 'cancel'). What you need to do is put your javascript inside a function, and place it in the <head> section of your document, call it from the submit button, with onsubmit="", and count the number of checked boxes inside javascript. then if they click cancel, the page just stays where it is and nothing is posted, otherwise it's posted.
-
Pre-populate the selected item of dropdown box based on an ID
WebStyles replied to LondonChris's topic in PHP Coding Help
echo $record['SubChannel']; (to see what's in it, if it's empty, sounds like the $_GET['id'] value does not exist in the database, or the database field names are not the same as `ID` or `SubChannel` change this: $r = mysql_query("select * from tblhighlights where ID = ".$_GET['id']); for this: $r = mysql_query("select * from tblhighlights where ID = ".$_GET['id'])or die(mysql_error()); to see if it spits out an error or not. Hope this helps -
where's the rest of the code? can you please publish the form with the checkboxes?