Jump to content

Yesideez

Members
  • Posts

    2,342
  • Joined

  • Last visited

Everything posted by Yesideez

  1. Set up a form in the firest page and make a hidden input: [code]<input type="hidden" name="cheeseopt" value="notliked">[/code] Then on the second script use something like this: [code]$cheese=$_POST['cheeseopt'];[/code] Use $_POST if in your form you use method="post" and $_GET if you use method="get" The difference is POST sends the form data in a packet whereas GET adds the form data onto the end of the URL and sends it that way - POST is more secure.
  2. If you surround your code with the bbcode "CODE" tags it'd be easier to read. Also, I suggest being a little more specific with what your problem is instead of just saying it doesn't work. Try and say what you want it to do, what it isn't doing and what data you're throwing at it - will increase the chances of some help. But! Saying that I did see this little abnormality: [code]if(!$name or !$email or !$address) {[/code] Try changing to: [code]if(!$name || !$email || !$address) {[/code]
  3. As an extra from Prismatic, you can disable or remove the submit button [in a form] after its been clicked to prevent users clicking it more than once but for this you'd need to add a little javascript to hide it once pressed - surprised how many people keep clicking adding more data on a slow connection.
  4. I use something like this: [code]if (mysql_query("UPDATE table SET `field`='$newcontents' WHERE `condition`='true'")) {   echo "Update successful"; } else {   echo "Update failed"; }[/code] It works for me :)
  5. If you're trying to get stats of players on Runescape (or any other online game) then you might as well stop. Unless you have access to the game's database then forget it and you won't get access unless the owner gives you access (and I very much doubt they will no matter how nicely you ask) or you're good at getting in through a closed door.
  6. OK you're closing the connection to the database after running a query then counting the result. Any further calls to the database will not work as there is no longer a connection. What you need to do is keep the connection open then use something like this: [code]$header="From: Ggap <jason@domain.com>\r\n"; $body="This is a test email for Ggap New Show Reminders"; $subject="Ggap Show Reminder"; $query=mysql_query("SELECT email FROM email_list"); while ($fetch=mysql_fetch_array($query)) {   $email=$fetch[email];   if (!mail($email,$subject,$body,$header)) {echo "Email failed for $email<br>";} }[/code] Then close the connect at the end. Off the top of my head, hope it works :)
  7. A couple days ago I added my MMORPG to the games section to the free scripts area for free download. It contains the entire set of scripts, includes, images and MySQL table information needed to set it up and get it running. I was wondering how long it takes for it to show active? I know it has to be verified by a moderator first but I was wondering how long this usually is?
  8. If you look at the above script you can see that the definitions for the drop-down box are enclosed in <select> and </select> tags. The options are defined usign <option> and </option> tags. All you need to do is create another set of these tags inside the same form with a list of what you want and modify the PHP part to take action on the selected option(s). For example: [code]<form action="menu.php" method="post"> <select name="color"><option value="red">Red</option><option value="green">Green</option><option value="blue">Blue</option></select> <select name="size"><option value="sm">Small</option><option value="md">Medium</option><option value="lg">Large</option></select> <input type="submit" name="subchoose" value="Make Choice" /> </form>[/code] Then in the PHP section you would have something like: [code]<?php $img=""; if ($_POST['subchoose']) {   $optcol=$_POST['color'];   $optsize=$_POST['size'];   if ($optcol=="blue"&&$optsize=="lg") {     header("Location: bl.html");     exit;   }   if ($optcol=="blue") {$img='<img src="blue.gif" border="0" />';} }[/code] Now all you need is to display the image in the HTML section. Just after the </form> tag add this line: [code]<?php echo $img; ?>[/code] You can really place that pretty much wherever you want but it must be between the <body> and </body> tags.
  9. By the looks of it you've not set $load to be anything before its used/checked. Try using this: [code]if (!empty($load)) {   if (is_file($load . ".php")) {     include($load . ".php");   } }[/code]
  10. Hi, this is completely off the top of my head so I can't guarantee that this will work - I'm going to attempt to write the script... [code]<?php if ($_POST['subchoose']) {   $opt=$_POST['opt'];   switch ($opt) {     case 1:       header("Location: home.php");       exit;       break;     case 2:       header("Location: shop.php");       exit;       break;     case 3:       header("Location: contact.php");       exit;       break;   } } ?> <html> <body>   <form action="menu.php" method="post">   <select name="opt"><option value="1">Home</option><option value="2">Shop</option><option value="3">Contact</option></select> <input type="submit" name="subchoose" value="Make Choice" />   </form> </body> </html>[/code] Thats the basic idea. The header() function is to change part of the header of the document, in this case the URL location and pointing it to the correct script. I've used exit() after to stop the script running any further should it have a problem changing the header for whatever reason. When you run the script the if() function will be false because the submit button hasn't been pressed. When it is, the if() becomes true and the rest is checked. If the menu option isn't valid (1, 2 or 3) then the menu appears again. One final word on header() - you can only change the header if nothing has been sent to the browser before its called so avoid using anything that will send output to the browser. If you don't, you'll get a message telling you the headers couldn't be modified. Hope this helps.
  11. Its simple enough. [a href=\"http://hanna.pyxidis.org/tech/m3u.html\" target=\"_blank\"]m3u file format[/a] You're basically creating a text file. As long as you know what data you need to make it the rest shouldn't be too much of a problem.
  12. I think you'll find a for() loop more appropriate here especially seeing that you're only using the range 1-10. [code]$wo_parts_total=0; for ($i=1;$i<=10;$i++) {   $pr="pr_$i";   $q="q_$i";   $wo_parts_total+=($_SESSION[$pr]*$_SESSION[$q]); }[/code] Enclosing variables in single quotes won't give you the values of the variables but will instead use that string exactly as shown - surrounding variables in double quotes will insert their contents.
×
×
  • 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.