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? Link to comment https://forums.phpfreaks.com/topic/22882-if_postsubmit/ 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} Link to comment https://forums.phpfreaks.com/topic/22882-if_postsubmit/#findComment-103118 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] Link to comment https://forums.phpfreaks.com/topic/22882-if_postsubmit/#findComment-103120 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'];} Link to comment https://forums.phpfreaks.com/topic/22882-if_postsubmit/#findComment-103126 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] Link to comment https://forums.phpfreaks.com/topic/22882-if_postsubmit/#findComment-103128 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? Link to comment https://forums.phpfreaks.com/topic/22882-if_postsubmit/#findComment-103663 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 Link to comment https://forums.phpfreaks.com/topic/22882-if_postsubmit/#findComment-103670 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... Link to comment https://forums.phpfreaks.com/topic/22882-if_postsubmit/#findComment-103694 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 ;) Link to comment https://forums.phpfreaks.com/topic/22882-if_postsubmit/#findComment-103696 Share on other sites More sharing options...
brown2005 Posted October 4, 2006 Author Share Posted October 4, 2006 thanks very much... Link to comment https://forums.phpfreaks.com/topic/22882-if_postsubmit/#findComment-103699 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.