Jump to content

If($_POST['submit'])


brown2005

Recommended Posts

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 the

if (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

[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

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.