brown2005 Posted October 3, 2006 Share Posted October 3, 2006 Hi,On my processing pages... should i use If($_POST['submit'])all the time or does it not matte? Quote Link to comment Share on other sites More sharing options...
steveclondon Posted October 3, 2006 Share Posted October 3, 2006 if you are testing to see if a form as been posted you need to test as followsif (isset($_POST['submit'])){// do what ever here if the form has been submited} Quote Link to comment Share on other sites More sharing options...
trq Posted October 3, 2006 Share Posted October 3, 2006 You should check any variable exists before you use it.[code=php:0]if (isset($_POST['submit'])) {[/code] Quote Link to comment Share on other sites More sharing options...
brown2005 Posted October 3, 2006 Author Share Posted October 3, 2006 at the mo my say login_process.php script is....$session_start();$username = $_GET['username'];$email = $_GET['email'];$image= $_GET['mage'];so to make script better should i put theif (isset($_POST['submit'])) {$username = $_GET['username'];$email = $_GET['email'];$image= $_GET['mage'];} Quote Link to comment Share on other sites More sharing options...
trq Posted October 3, 2006 Share Posted October 3, 2006 Yes. But you should also check the other before using them. The turnary operator is great in this siuation....[code=php:0]$username = $_GET['username'] ? $_GET['username'] : "";$email = $_GET['email'] ? $_GET['email'] : "";$image = $_GET['mage'] ? $_GET['mage'] : "";[/code] Quote Link to comment Share on other sites More sharing options...
brown2005 Posted October 4, 2006 Author Share Posted October 4, 2006 $username = $_GET['username'] ? $_GET['username'] : "";can you explain what this actually means please? Quote Link to comment Share on other sites More sharing options...
obsidian Posted October 4, 2006 Share Posted October 4, 2006 [quote author=brown2005 link=topic=110381.msg446603#msg446603 date=1159964853]$username = $_GET['username'] ? $_GET['username'] : "";can you explain what this actually means please?[/quote]it's another way to write this:[code]<?php// instead of this:if (isset($_GET['username'])) $username = $_GET['username'];else $username = '';// just do this:$username = isset($_GET['username']) ? $_GET['username'] : '';?>[/code]read up on the ternary operator in the PHP manual for more info Quote Link to comment Share on other sites More sharing options...
brown2005 Posted October 4, 2006 Author Share Posted October 4, 2006 "read up on the ternary operator in the PHP manual for more info"u got a link to this info please... Quote Link to comment Share on other sites More sharing options...
obsidian Posted October 4, 2006 Share Posted October 4, 2006 [quote author=brown2005 link=topic=110381.msg446637#msg446637 date=1159967712]"read up on the ternary operator in the PHP manual for more info"u got a link to this info please...[/quote]really tough: http://www.php.net/ternary ;) Quote Link to comment Share on other sites More sharing options...
brown2005 Posted October 4, 2006 Author Share Posted October 4, 2006 thanks very much... Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.