Jump to content

Hepp

Members
  • Posts

    33
  • Joined

  • Last visited

    Never

Everything posted by Hepp

  1. Ken, I LOVE YOU. THANK YOU. So simple, yet I need sleep. Thanks buddy. Revised correct code for anyone who is looking: <?php function aboutUs() { echo "This is the <b>about</b> section.<p>"; } function otherPage() { echo "This is the <b>other</b> section.<p>"; } if (isset($_GET['page'])) { $page = ($_GET['page']); if ($page == "aboutUs") { aboutUs(); } elseif ($page == "otherPage") { otherPage(); } else { echo ""; } } ?> <a href=static.php?page=aboutUs>About</a> <a href=static.php?page=otherPage>Other</a> Thanks again Ken =) -Hepp
  2. The problem is that when you click the link, it does not display the code from the function like I've been trying to get it to, you know? But the function calling the variable, I removed it. I tried something earlier, forgot to get rid of it. Here's the revised code: <?php function aboutUs() { echo "This is the <b>about</b> section."; } if (isset($_GET['page'])) { $page = ($_GET['page']); if ($page[0] == "aboutUs") { aboutUs(); } else { echo ""; } } ?> <a href=static.php?page=aboutUs>About</a> Can you not refer to $page as a single and then to an array? I couldn't think of another way to do this. Thanks man. -Hepp
  3. Hepp

    Help?

    You set your index page to tos.php in your server settings, or place the tos code in the index page, and make a home.html page and link after they agree to them at the bottom. Simple.
  4. Hey man, thanks for replying. I quickly threw it in the title - apologies. I'm trying to have a page, and when the link is clicked (bottom of code), it pulls out the function using $_GET because I'm looking to make many of these. And the problem is that the text doesn't appear from the function when the link is clicked. Thanks. -Hepp
  5. To answer your question, yes I read the FAQs, and there was a Select Case example there. I've been coding for 3+ years now, but this is angering me. Snippet of code: <?php function aboutUs($page) { echo "This is the <b>about</b> section."; } if (isset($_GET['page'])) { $page = ($_GET['page']); if ($page[0] == "aboutUs") { aboutUs(); } else { echo ""; } } ?> <a href=static.php?page=aboutUs>About</a> I've been trying to get that to work all day. Is there something I am overlooking, doing wrong, or forgetting? Bleh I need sleep Thanks so much. -Hepp
  6. Thank you for your reply. Your solution unfortunately did not work, and gave me the same error :-\ Thank you for the help though. Any other suggestions? Anyone? ???
  7. Thank you for your help again. I don't quite understand what your saying, but I need to use the email the user supplies in the input field in order for them to receive the mail and not the one in php.ini. Like: They enter their email, click "Retrieve Password", the PHP code matches their email with the one in the database and grabs their password, puts the correct password in the message, then sends the email to that users email, along with their password. I need this. Anymore suggestions?
  8. Progress... thank you for your reply mmarif4u. I set the header email to the one in php.ini... Now I only get this error message: Warning: mail() [function.mail]: SMTP server response: 550 Account is not local, relaying disallowed. Any more ideas? Anyone?
  9. I have two different servers, a web and a mail server. The mail server uses localhost and the port of 25 for SMTP in php.ini, and the "sendmail_from" is set in php.ini - I'm 100% sure. I tried making a simple mail script work... <?php // The message $message = "Line 1\nLine 2\nLine 3"; // In case any of our lines are larger than 70 characters, we should use wordwrap() $message = wordwrap($message, 70); // Send mail('BlahBlah@gmail.com', 'My Subject', $message); ?> I have the php.ini "sendmail_from" setting to a different email than in that code. I need the code to have different emails for such things as a forgot password script when parsing info over $_POST, like the email. I need it to send the info to their email, not the one in php.ini. Warning: mail() [function.mail]: "sendmail_from" not set in php.ini or custom "From:" header missing in *FilePath* on line *SomeNumber* And it's given me a headache to the max. And now I'm angry at this thing. GAH! ??? Any suggestions? Thanks for the help if so
  10. [url=http://www.propergrammar.com/]This Will Help You With All Your Needs.[/url]
  11. I no understand your speak.
  12. Try putting the connection to the database and whatnot in its own file, like config.php, and then include it in submit.php.
  13. The bottom of your coding isn't correct: Change: [code] else echo "not added"; { [/code] To: [code] else { echo "not added"; } [/code]
  14. You could search for a PHP Job Script at this link: http://www.hotscripts.com
  15. This probably won't help, but it's worth a try. Instead of: [code] <form method="post" action="submit.php"> [/code] Try: [code] <form action="submit.php" method="post"> [/code]
  16. Try this: [code] $name = "Dave Lawson"; if ($hisname >= '1') { print 's and '; } else { print 's'; } print $name; [/code]
  17. Yeah, if anyone knows how to do that and could help, that would be the best. Thanks =)
  18. Cause there's going to be more values than just the three, there's going to be billions at most. I just can't see how it could add up, or order by the itemname.
  19. OMG! IT WORKED! THANK YOU SASA AND MAINEWOODS! But... that led to yet another problem. I can't find a way, no matter what, to get the items displayed to order by "itemname". Instead, they're ordering in the order they were purchased and inputed into the database. I also was wondering if there is a way that you can add all the values together of all the items in the array to get it to display a variable called "$totalamount"...? I can't figure out how to do both, but seriously, thank you MaineWoods and Sasa for all the help so far  ;D Here is my current coding below if it helps: [code] <?php include('config.php'); $itemidlistquery = mysql_query("SELECT itemidlist FROM customers WHERE username='".$_COOKIE['username']."' LIMIT 1"); $itemidlistrow = mysql_fetch_array($itemidlistquery); $itemidlist = ($itemidlistrow['itemidlist']); $itemslist = explode(",",$itemidlist); $inventorystring = ""; foreach($itemslist as $a => $b) { $inventorystring .= "itemid='$b' OR "; } $inventorystring .= rtrim($inventorystring, " OR "); $itemsquery = mysql_query("SELECT * FROM items WHERE $inventorystring ORDER BY itemname LIMIT 1"); while ($itemsrow = mysql_fetch_array($itemsquery)) { $itemnames = mysql_query("SELECT * FROM items ORDER BY itemname"); while ($onename = mysql_fetch_array($itemnames)) { $transname[$onename['itemid']] = $onename['itemname']; } $itemidlist2 = ($itemidlistrow['itemidlist']); $itemslist2 = explode(",",$itemidlist2); $valuesarray = array_count_values($itemslist2); foreach ($valuesarray as $name => $amount) { $page .= " <tr> <td width=100% align=center> <b>".$transname[$name]."</b> (". $amount .") </td> </tr>\n"; } $page .= " <br>\n"; } ?> <link href=styles.css rel=stylesheet type=text/css> <html> <head> </head> <body> <center> <form action=inventory.php method=post> <table width=60% align=center> <tr> <td align=center width=100% colspan=2 cellpadding=3> <b>Inventory</b> </td> </tr> <tr> <td width=100% align=center> <br> You have <font color=lime><b><?php echo($totalamount); ?></b></font> items. </td> </tr> </table> <?php echo($page); ?> </table> </form> <p> </center> </body> </html> [/code] Thank you again. I am very grateful.
  20. Okay, so I tried that, and it didn't exactly work. I had to edit it a bit too to get it to at least say what it does now. It displays the following at the top of the page now: [code] = 6 = 8 = 10 = 6 = 8 = 10 = 6 = 8 = 10 [/code] The numbers are correct, and I know it's almost there... but I just can't think of this. Here is the coding for the entire page itself: [code] <?php include('config.php'); $itemidlistquery = mysql_query("SELECT itemidlist FROM customers WHERE username='".$_COOKIE['username']."' LIMIT 1"); $itemidlistrow = mysql_fetch_array($itemidlistquery); $itemidlist = ($itemidlistrow['itemidlist']); $itemidlist2 = ($itemidlistrow['itemidlist']); $itemslist = explode(",",$itemidlist); $inventorystring = ""; $itemidquery = mysql_query("SELECT itemid FROM items"); $itemidrow = mysql_fetch_array($itemidquery); foreach($itemslist as $a=>$b) { $inventorystring .= "itemid='$b' OR "; } $inventorystring .= rtrim($inventorystring, " OR "); $itemsquery = mysql_query("SELECT * FROM items WHERE $inventorystring ORDER BY itemname"); //NEW CODING $getnames = "SELECT * FROM items"; //gets all the rows $itemnames = mysql_query($getnames); while (!$onename = mysql_fetch_array($itemnames)) {     $transname[$onename['itemid']] = $onename['itemname']; //building the $transname array } //the $transname array should contain all the values in the items table //it uses the primary key of each record as the array key as well while ($itemsrow = mysql_fetch_array($itemsquery)) { $itemslist2 = explode(",",$itemidlist2); $valuesarray = array_count_values($itemslist2); foreach ($valuesarray as $key => $value) { echo $transname[$key] . ' = ' . $value . ' '; } echo '<br>'; } ?> <!-- //OLD CODING while ($itemsrow = mysql_fetch_array($itemsquery)) { $itemslist3 = explode(",",$itemidlist2); $valuesarray = array_count_values($itemslist3); foreach ($valuesarray as $key => $value) {         //write some code to get the translation of         //the $key code from your database //get $key to euqal $itemid and them for that $itemid to equal that $values $itemid = ($itemsrow['itemid']); $whatevs = ($count_values[$value]); } $page .= " <tr> <td width=100% align=center> <b>".$itemsrow['itemname']."</b> (". $whatevs .") </td> </tr>\n"; } --> <link href=styles.css rel=stylesheet type=text/css> <html> <head> </head> <body> <center> <form action=inventory.php method=post> <table width=60% align=center> <tr> <td align=center width=100% colspan=2 cellpadding=3> <b>Inventory</b> </td> </tr> </table> <?php echo($page); ?> </table> </form> <p> </center> </body> </html> [/code] MaineWoods, again, thank you so much for sticking with me and helping me. You are a PHP God. Thank you so much.  =)
  21. [url=http://www.hotscripts.com]The Right Direction[/url] ;D
  22. You have all single quotes. Once you use the print or echo function in PHP, you need to use quotes. Like this: [color=green]echo("<font face=\"Verdana\">OMG THIS IS SO COOL!</font>");[/color] You have: [color=red]echo('<font face='Verdana'>OMG THIS IS SO COOL!</font>');[/color] You can't do that. That's why you're getting that error.
  23. I do have a seperate table called "items", that has the field "itemid" and "itemname" to communicate with "itemidlist" to display the name of the item in the variable "$page". I can't get my head to think of how I could tell the code to display how many times that itemid number is in "itemidlist" for the itemname. I don't know how to get it to do that in that while() loop...  ???
×
×
  • 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.