Jump to content

Gast

Members
  • Posts

    131
  • Joined

  • Last visited

    Never

Everything posted by Gast

  1. The easiest thing to do to start with is to simply check if the mail() function with some test values sends correctly. Then try commenting out lines or changing values until you can find out why it wont send.
  2. [!--quoteo(post=358182:date=Mar 25 2006, 10:07 AM:name=tgs)--][div class=\'quotetop\']QUOTE(tgs @ Mar 25 2006, 10:07 AM) [snapback]358182[/snapback][/div][div class=\'quotemain\'][!--quotec--] Okay, I have a switch() set up...kind of...in a table. Anyway, I can get the defualt done (not that difficult) Now...my problem. coding my links so that open the different files in the switch. Thanks, hope that explains it well enough. [/quote] Well I don't know exactly if this is exactly what you mean, but the easiest way is to use $_GET. Say if you have a page that is called "example.php" and you want to have 5 different sections to that page, you could have "example.php?id=1", "example.php?id=2", "example.php?id=3" and so on... To do this and include a relevant file have this: [code]<?php switch($_GET['id']) { default :     include("defaultpage.php");     break; case "1" :     include("page1.php");     break;     case "2" :     include("page2.php");     break;     } ?>[/code] Hope that helps.
  3. I think its the way you handle the form. Just set the form action to the same page that you are or and then add this at the top: [code]<?php if(isset($_POST['Submit'])) {     goninja($_POST['adminusr'], $_POST['adminpswd'], $_POST['adminemail'], $_POST['adminloca'], $_POST['gamename'], $_POST['gameurl']); } ?>[/code] That should work. I would also recommend changing: [code]$newpost[adminusr][/code] To this: [code]$newpost['adminusr'][/code] For all of the $newpost array.
  4. Well, I found that a book that helped with PHP was what help me. I used the Visual Quickstart guide to PHP by Larry Ullman which was quite good and explained all the basics. I then found that sites, especially this one, helped a lot. Try making small scripts such as a user system (to get used to sessions and cookies) and then a file upload (to use the $_FILES superglobal), etc. to get used to each aspect. If you get stuck then post a problem here and someone can direct you where you went wrong and you will learn how to go about a similar problem next time. As you said you are familiar with programming languages, don't know whether you mean anything like C, C++, C# or ActionScript, as these all have roughly the same syntax as PHP. If you know something like VB, .NET or ASP, then they won't really help you with learning PHP as they are completely different! Also, as a side note, the phpBB code can be a bit confusing at first. Having used it since before I knew PHP I know what you mean, the main reason is it being written in an OOP style of PHP, which is something that can be very hard to grasp without knowing PHP for a while first. Let me know how you get on, Niall :)
  5. An input hidden field sends a value through the form but can't actually be seen in the browser. For example a common one used is the maximum file size handled by a file upload form. They are sometimes used for external forms that you can't control, like Paypal. You need to send your details through a form but not so you actually have to enter them in a form every time.
  6. [!--quoteo(post=358293:date=Mar 25 2006, 05:51 PM:name=turbocueca)--][div class=\'quotetop\']QUOTE(turbocueca @ Mar 25 2006, 05:51 PM) [snapback]358293[/snapback][/div][div class=\'quotemain\'][!--quotec--] [code]    if($page > 1)     {         $prev=($page-1);         echo "<a href="".$_SERVER['PHP_SELF']."?page=$prev"><<Previous</a> ";     } [/code] Lines 26-30 [a href=\"http://infocenter.awardspace.com/pages.php\" target=\"_blank\"]http://infocenter.awardspace.com/pages.php[/a] there's an error I can't repair. [/quote] Its your quotes. It should be: [code]    if($page > 1)     {         $prev=($page-1);         echo "<a href=\"".$_SERVER['PHP_SELF']."?page=$prev\"><<Previous</a> ";     } [/code] And the same for the next link if it is the same problem. You need to escape the actual quote used for the HTML tag.
  7. [!--quoteo(post=358044:date=Mar 24 2006, 08:37 PM:name=lpxxfaintxx)--][div class=\'quotetop\']QUOTE(lpxxfaintxx @ Mar 24 2006, 08:37 PM) [snapback]358044[/snapback][/div][div class=\'quotemain\'][!--quotec--] I also have a question very similiar to this. How do you create a cell where the whole row is a link, not just the text? [/quote] Or you can do: [code]<tr>     <td style="background-color:#FFFFFF" onmouseover="this.style.backgroundColor='#EEEEEE'" onmouseout="this.style.backgroundColor='#FFFFFF" onclick="window.location='otherpage.php'">Text in row</td> </tr>[/code]
  8. [!--quoteo(post=358114:date=Mar 25 2006, 01:36 AM:name=0p3n_p0rT)--][div class=\'quotetop\']QUOTE(0p3n_p0rT @ Mar 25 2006, 01:36 AM) [snapback]358114[/snapback][/div][div class=\'quotemain\'][!--quotec--] Hi, I recently made a chatroom in php. All messages are written to a chat log, and that chat log is what is read in the conversation screen, which is an iframe. However, I need the frame to refresh every 2 seconds or so, so that it is constantly updated. At the moment, I am using: [code]<META HTTP-EQUIV="Refresh" CONTENT="2"; URL="chatlog.htm">[/code] However, whenever it refreshes and the length of the chat goes beyond the iframes capacity, a scroll bar appears. I want it to automatically keep to the bottom, as whenever it refreshes, it takes the browser to viewing the top part of the iframe. Also, whenever there is a new message, I want it to automatically scroll down to it so it is in view. How could I do this? Also, with the PHP: I have a "connected" list. Whenever someone joins the page, the username from their session is logged to "connected.php". However, I want it to be removed when they exit the chat. Not all people would use a "logout" button so I would need it to somehow remove their name from the connected log file when their session is killed. How could I do that? [/quote] For the refreshing, when you generate the results of the chat, then add an anchor link to the last result: [code]<a name="latestmsg"></a>[/code] Then refresh with: [code]<META HTTP-EQUIV="Refresh" CONTENT="2"; URL="chatlog.htm#latestmsg">[/code] For the PHP, the only way I think possible is to use AJAX. Take a look at the links in my sig at learning how to use it, but basically you can send a request using the "onabort" event: [code]<body onabort="sendRequest('logout', '<? echo $_SESSION['user_id']; ?>');">[/code] Or something similar, as you cannot actually execute a PHP function with a JS event handler. Hope that helps! :)
  9. [!--quoteo(post=357775:date=Mar 23 2006, 09:13 PM:name=seaten)--][div class=\'quotetop\']QUOTE(seaten @ Mar 23 2006, 09:13 PM) [snapback]357775[/snapback][/div][div class=\'quotemain\'][!--quotec--] I want the user to pick a font type, at the moment I have it in check boxes but I prefer to have it in a drop down list. But the key is to have each font option displayed in their own style. Any Ideas ? here is my current code: <b>Choose a Font Style for your Text:</b> <font face= arial>Arial</font>&nbsp; <input name="fontType" type="checkbox" id="sel_templateA" value="arial"> <font face="Bookman Old Style">Bookman Old Style&nbsp;</font> <input name="fontType" type="checkbox" id="sel_templateA" value="Bookman Old Style"> <font face="Comic Sans MS">Comic Sans&nbsp;</font> <input name="fontType" type="checkbox" id="sel_templateA" value="Comic Sans MS"> <font face="Courier">Courier&nbsp;</font> <input name="fontType" type="checkbox" id="sel_templateA" value="Courier"> [/quote] The two things that I would recommend is not using the <font> tag. It is not widely used anymore and won't validate. Use <span style="font-family:Arial"> instead. Also, I wouldnt use a font like Bookman Old Style as not every user is going to have that font. Stick with Verdana, Trebuchet, Arial, Courier, Tahoma, etc. For your code have this: [code]<select name="fontType" id="selTemplateA">      <option value="Arial" style="font-family:Arial">Arial</option>      <option value="Tahoma" style="font-family:Tahoma">Tahoma</option>      <option value="Trebuchet MS" style="font-family:'Trebuchet MS'">Trebuchet MS</option> </select>[/code] That should work! :)
  10. Well a simple table that would have a header and then a navigation column and a main content area, that would look like: [code] +----------------+ |                | +----+-----------+ |    |           | |    |           | |    |           | |    |           | |    |           | |    |           | |    |           | +----+-----------+[/code] You would use the code: [code]<table width="760" border="0" cellpadding="5" cellspacing="0">     <tr>         <td colspan="2">             Header content here         </td>     </tr>     <tr>         <td width="25%">             Navigation here         </td>         <td width="75%">             Main content         </td>     </tr> </table>[/code]
  11. [!--quoteo(post=357821:date=Mar 24 2006, 01:45 AM:name=.-INSANE-.)--][div class=\'quotetop\']QUOTE(.-INSANE-. @ Mar 24 2006, 01:45 AM) [snapback]357821[/snapback][/div][div class=\'quotemain\'][!--quotec--] what ever itll do the same thing [/quote] Yes, but it will probably not validate.
  12. Not sure exactly how to have it so that when you select the text and then click the button it adds tags around it, but you can do this: [code]<input type="button" value="HREF Tag" onclick="document.getElementById('textareaid').value = document.getElementById('textareaid').value + '<a href=\"\"></a>'" />[/code] Or something similar.
  13. Might work by changing the following: [code]function hideNav() {     document.getElementById('myDiv').style.display="none"; }[/code]
  14. Easiest way to control textarea height and width is to use CSS: [code]<textarea style="width:200px; height:100px; border:1px solid #666666"></textarea>[/code]
  15. Like vic-wdd said, you need to use &amp; in the code instead of & for it to be valid XHTML. Also, if you are writing in JavaScript that directs to a URL like "http://www.example.com/page.php?act=test&something=this", for example you cannot use the &amp; in the JS code, it won't work, so you must use a normal ampersand even if it won't validate.
  16. [!--quoteo(post=357060:date=Mar 21 2006, 07:46 PM:name=shocker-z)--][div class=\'quotetop\']QUOTE(shocker-z @ Mar 21 2006, 07:46 PM) [snapback]357060[/snapback][/div][div class=\'quotemain\'][!--quotec--] Nope it's not working.. :( I've testing in IE 6, Firefox and opera with no joy.. [/quote] Do you mean the actual box to select itself, or the options that appear in the select box? The options that appear cannot be moved or changed, they appear where they want in different browsers. If you have a lot of options, sometimes they go right to the top of the screen which doesnt look that great I agree. If you really want to make them appear exactly where you want them, etc. then you would have to make one in JavaScript/DHTML. Take a look around the web for free ones or how to make one.
  17. That is not what he means, and I would advise using <input type="button" /> not the <button> tag. I assume you want to have a form that they can submit normally but also cancel it if they want. If you want information to send when they click cancel as well, then you cannot have 2 submit buttons, but you can use: [code]<input tpye="button" value="Cancel" onclick="window.location='differentpage.php'" />[/code] Hope that helps. If you do want it to send information, then let me know and you can do it with javascript.
  18. If it is a button (as in an input button): [code]<input type="button" value="Roster" onclick="document.getElementById('iframeId').src='roster.htm'" />[/code] Where 'iframeId' is the ID of the iframe you want to change.
  19. I think this is a bug with IE, not sure how it displays with Firefox. You cannot set the flash file as a background image, so the only thing I can suggest is to hide the flash file when you make the javascript menu appear.
  20. Does anyone know where I can find a script that will highlight PHP code actually through PHP. I am not that good at regular expressions and I have seen these done before? TIA
  21. [!--quoteo(post=354566:date=Mar 13 2006, 05:00 PM:name=slpwkr)--][div class=\'quotetop\']QUOTE(slpwkr @ Mar 13 2006, 05:00 PM) [snapback]354566[/snapback][/div][div class=\'quotemain\'][!--quotec--] is it possible to read a file starting from the bottom? thanx! [/quote] You could try this: [code]<?php // Read entire file into variable $file = file_get_contents("path/to/your/file.php"); // Split each line into a value of $lines array $lines = explode('\n', $file); // Count the number of lines $count = count($lines); // Create empty variable $temp = NULL; // Read each line starting from the bottom into a variable for($i=$count; $i==0; $i--) {     $temp .= $lines[$i] . "<br />"; } // Echo values echo $temp; ?>[/code] That code might need some ajusting... :)
  22. [!--quoteo(post=354566:date=Mar 13 2006, 05:00 PM:name=slpwkr)--][div class=\'quotetop\']QUOTE(slpwkr @ Mar 13 2006, 05:00 PM) [snapback]354566[/snapback][/div][div class=\'quotemain\'][!--quotec--] is it possible to read a file starting from the bottom? thanx! [/quote] You could try this: [code]<?php // Read entire file into variable $file = file_get_contents("path/to/your/file.php"); // Split each line into a value of $lines array $lines = explode('\n', $file); // Count the number of lines $count = count($lines); // Create empty variable $temp = NULL; // Read each line starting from the bottom into a variable for($i=$count; $i==0; $i--) {     $temp .= $lines[$i] . "<br />"; } // Echo values echo $temp; ?>[/code] That code might need some ajusting... :)
  23. Simply do this: [code]$date = date("d/m/y "); $date .= date("G") - 8; $date .= date(":i:s"); echo $date;[/code]
×
×
  • 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.