
webmaster1
Members-
Posts
607 -
Joined
-
Last visited
Never
Everything posted by webmaster1
-
Cheers, salathe!
-
Is there a difference between <?php and <? ?
-
Is there such a thing as using the include() or require() functions too much?
-
Cheers. What's the best free PHP editor featuring colored keywords and suggestions à la Dreamweaver?
-
Thanks. Alritey. Do I need to close all of my database connections? (mysql_close($link);)
-
I see. Just found it through google: http://www.phpfreaks.com/page/irc-live-chat I'm not very familiar with IRC. I've ended up on a Mibbit page asking me to choose a channel. Is IRC currently used a whole lot between members in relation to quickfire coding help?
-
Is there a difference between killing and destroying sessions?
webmaster1 replied to webmaster1's topic in PHP Coding Help
// If it's desired to kill the session, also delete the session cookie. Cheers for that explanation. -
Text box adding text to HTML script & HTML PHP checker
webmaster1 replied to JasperHope's topic in PHP Coding Help
Example of an if condition: <html> <body> <?php $d=date("D"); if ($d=="Fri") { echo "Hello!<br />"; echo "Have a nice weekend!"; echo "See you on Monday!"; } ?> </body> </html> List of operators that can be used in your if condition (within the set of brackets after the word 'if'): http://www.w3schools.com/php/php_operators.asp -
Is there a difference between killing and destroying sessions?
webmaster1 replied to webmaster1's topic in PHP Coding Help
The manual explains that killing destroys the session data and the session whereas destroying destroys the session. Would I be correct to assume that I only need to destroy the session for my log out page? -
While the manual provides an example on how to destroy a session it also provides a block of code that kills the session: // If it's desired to kill the session, also delete the session cookie. // Note: This will destroy the session, and not just the session data! if (ini_get("session.use_cookies")) { $params = session_get_cookie_params(); setcookie(session_name(), '', time() - 42000, $params["path"], $params["domain"], $params["secure"], $params["httponly"] ); } If I want to log out and stop the session completely, should I kill, destroy or both?
-
Often, I'll put off asking certain questions in the PHP coding help section because I can't justify starting up an entire thread for a question that requires quick verification or theoretical explanation rather than appraising specific blocks of code. e.g. What's the difference between destroying and killing a session? Rather than posting a thread for the above example I'd usually just make an educated guess but a quickfire thread could easily dispel any ambiguity. I believe that such a thread would be popular due to the answers being less laborious. I for one, would lurk around the thread frequently in hopes of assisting a fellow members. Thread Specifications: One continuous stickied thread that is never closed. Questions must be brief, require a brief response and of a theoretical, conceptual or verifiable nature. Thread scope: I'd be happy to seethis in the PHP coding help section but the HTML and CSS sections would be a bonus. Just some food for thought. I could be alone on this.
-
-
jQuery perhaps? I can't seem to find one though.
-
How do I create superglobal session variables?
webmaster1 replied to webmaster1's topic in PHP Coding Help
Nuts. I had tried placing it at the beginning of my if else condition. Thanks Ken. -
Will a Meebo bar do the trick? It's similar but different: http://bar.meebo.com/
-
I've read the manual. I have the following: <?php if($count==1){ session_register("loginusername"); session_register("loginpassword"); header("location:/somewhere"); } ?> Since this approach is deprecated I've tried replacing the functions with the superglobals: <?php if($count==1){ $_SESSION['loginusername'] = $loginusername; $_SESSION['loginpassword'] = $loginpassword; header("/somehwere"); } ?> How do I correctly define the session variables? Should I be using session_start?
-
Good stuff. (Don't forget to mark solved if good to go)
-
That's sounds a bit odd but it's very likely a minor issue. Can you reveal more of your code (the more the better) so that I can try to reproduce what you're trying to achieve on my end? Naturally edit out your database password and any other sensitive information with an 'x'. I'm guessing it's how the SQL query is picking up on the values of the variables.
-
Howdy, As much as I’ve wanted to, I haven’t significantly edited your html mark-up or added CSS. You really shouldn’t be using a table, let alone a table within a table to define your layout. Tables are for presenting tabular data such as a database. Instead, you should be using divs styled by CSS. Learn more here: http://www.w3.org/Style/CSS/ In any case, I’m by no means a PHP expert but the following validation works - just copy and paste: <?php // If the submit button is pressed... if (isset($_POST['submit'])) { // Validation // If score one is empty or non-numeric define a message as a variable... if (strlen($_POST['scoreone']) > 0 && is_numeric($_POST['scoreone'])) {$scoreone=TRUE;} else {$scoreone=FALSE; $message_scoreone=" *Error! Please input a numeric value for score one!";} // If score two is empty or non-numeric define a message as a variable... if (strlen($_POST['scoretwo']) > 0 && is_numeric($_POST['scoretwo'])) {$scoretwo=TRUE;} else {$scoretwo=FALSE; $message_scoretwo=" *Error! Please input a numeric value for score two!";} // If score one = score two and are not blank define a message as a variable: if (($_POST['scoreone'] == $_POST['scoretwo']) && (strlen($_POST['scoreone']) > 0) && (strlen($_POST['scoretwo']) > 0)) {$scorecheck=FALSE; $message_scorecheck=" *Error! Please ensure that score one and two are not the same!";} else {$scorecheck=TRUE; } // If score one and two are validated and do not match then pass the variables via url... // THE HEADER FUNCTION MUST BE POSITIONED BEFORE THE OPENING HTML TAG!!! if ($scoreone && $scoretwo && $scorecheck) { //WE'RE USING THE HEADER FUNCTION INSTEAD OF THE FORM TO SEND THE VARIABLES VIA URL... header('Location:?site=cupactions&action=score&clan1=$clanID&matchID=$matchID&cupID=$cupID'); } } ?> <html> <body style="color: white; font-family: Arial, sans-serif;"> <!--<form action="?site=cupactions&action=score&clan1=$clanID&matchID=$matchID&cupID=$cupID" method="post" name="post">--> <form action="<?php echo $_SERVER['PHP_SELF']; ?>#marker" method="post" enctype="multipart/form-data"> <!--START OUTER TABLE--> <table width="100%" cellspacing="0" border="0" cellpadding="2" bgcolor="$border"> <tr> <td bgcolor="$pagebg"> </td> </tr> <tr> <td bgcolor="$bg1"> <!--START INNER TABLE--> <table width="100%" border="0" align="center" cellpadding="2" cellspacing="0"> <tr> <td> %your% Score: </td> <td> <input name="scoreone" type="text" class="form_off" id="score1" onFocus="this.className=\'form_on\'" onBlur="this.className=\'form_off\'" size="3" value="<?php if (isset($_POST['scoreone'])) echo $_POST['scoreone']; ?>"> </td> <td> %opponent% Score: <input name="scoretwo" type="text" class="form_off" id="score2" onFocus="this.className=\'form_on\'" onBlur="this.className=\'form_off\'" size="3" value="<?php if (isset($_POST['scoretwo'])) echo $_POST['scoretwo']; ?>"> </td> </tr> <tr> <td colspan="2" style="color:red; padding-left: 10px; font-family: Arial, sans-serif;"> <?php if ($message_scoreone) echo "<p>".$message_scoreone."</p>"; ?> <?php if ($message_scoretwo) echo "<p>".$message_scoretwo."</p>"; ?> <?php if ($message_scorecheck) echo "<p>".$message_scorecheck."</p>"; ?> </td> <td colspan="1" align="right"> <input name="submit" type="submit" value="%submit%"> </td> </tr> </table> <!--END INNER TABLE--> </td> </tr> </table> <!--END OUTER TABLE--> </form> <body> </html> The form will now do one of four things: [*]Produce an error message if score one is not empty numeric. [*]Produce an error message if score two is empty or not numeric. [*]Produce an error if score one and two are the same. [*]If there are no errors the form will behave as usual. Pay attention to the comments I included within the code. Certain functions, such as the header() function should not be moved. Mark this topic as solved once you're good to go and for future reference, this should have been posted in the PHP coding help section of the forum.
-
Review this if you run into issues with any content following your floated elements: http://www.w3schools.com/css/pr_class_clear.asp
-
This appears to be a CSS issue and not a HTML issue. Conceptually you have a two-column layout and should treat it as such. I recommend rebuilding the page from scratch in the following manner: 1) Create a container div e.g. <div id="container"></div> 2) Position two divs within your container div e.g. <div id="leftcolumn"></div> and <div id="rightcolumn"></div> 3) Style the divs as required but ensure that the leftcolumn div is floated left and that the rightcolumn div is floated right. I couldn't find float:right; anywhere in your page. 4) Position your content within either of the two divs. Here's a good starting point: http://www.456bereastreet.com/lab/developing_with_web_standards/csslayout/2-col/ You can review your current code to death though it'll probably be quicker just to rebuild your page. Also, try using external style sheets, ids and classes. Inline styling, for me at least, defeats the purpose of css.
-
EDIT: Didn't realize this was solved. Ignore. Ouch, it looks nasty in IE6. The validation errors don't appear to be directly affecting the layout. How confident are you that this isn't just a regular cross-browser rendering issue? I suggest that you sequentially <!-- comment --> out each section of the index until you can isolate when and where the layout anomalies are occurring. After that it's simply a case of trouble-shooting why IE isn't listening to your specific styling (CSS). I know way too many folks that give up debugging cross-browser layout issues. Take the time to thoroughly debug using the <!--comment--> approach as suggested.
-
Yep, but not through HTML. What you're describing is basic form validation and you can achieve this using server-side (PHP) or client-side (javascript). Google "php form validation" or "javascript form validation". For PHP, you simply need to define the input of your text fields as variables and then compare them using a Boolean condition. I can do this for you if you paste the relevant code or explain what it is you're trying to achieve.
-
Difficulty including database connect info...
webmaster1 replied to webmaster1's topic in PHP Coding Help
The echo revealed that the table didn't exist. I changed the name of the table in phpMyAdmin but forgot to do so in dbinfo.php. Thanks PFMaBiSmAd. mysql_error() is a nifty function. Cheers for all the other tips (e.g. deprecations) too lads. -
Difficulty including database connect info...
webmaster1 replied to webmaster1's topic in PHP Coding Help
I understand what you're saying. I just posted the full code on the interim as requested whilst I'm implementing your suggestions. I'm not disregarding what you've said, I'm just a little slow at this. I'm checking echo mysql_error() now.