Jump to content

how do i add a default name if none was given


the-botman

Recommended Posts

hi guys..

 

i need to know how to add a default name if users do not add name to my logo gen

 

i was thinking about using an if statment here

session_start(); 
   $_SESSION['number'] = $_POST['number'];
   $_SESSION['name'] = $_POST['name'];
   $_SESSION['image'] = $_GET['image'];

 

php5.3

session_start();
$_SESSION['number']  =  $_POST['number'];
$_SESSION['name']  =  $_POST['name'] ?: 'some default';
$_SESSION['image']  =  $_GET['image'];

 

else

 

session_start();
$_SESSION['number']  =  $_POST['number'];
$_SESSION['name']  =  $_POST['name'] ? $_POST['name'] : 'some default';
$_SESSION['image']  =  $_GET['image'];

$_SESSION['name']  =  $_POST['name'] ?: 'some default';

 

I think is best not used as it will spread confusion, not many read the manual as thoroughly as we are :)

 

Spread confusion? Amongst who? The people who don't know the language well enough to understand it?

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.