Right now I am using this code to grab a variable in my URL:
<?php
$transaction_id = $_GET['transaction_id'];
if($transaction_id == "") {
$transaction_id = 'NA';
}
?>
So far I have only been grabbing that single variable, but now I need to grab a total of 5 variables. Will everything still work properly and operate fast and smoothly if I just copy and paste multiple codes right next to each other like this:
<?php
$transaction_id = $_GET['transaction_id'];
if($transaction_id == "") {
$transaction_id = 'NA';
}
?>
<?php
$transaction_id2 = $_GET['transaction_id2'];
if($transaction_id2 == "") {
$transaction_id2 = 'NA';
}
?>
<?php
$transaction_id3 = $_GET['transaction_id3'];
if($transaction_id3 == "") {
$transaction_id3 = 'NA';
}
?>
Or is there a more efficient way to combine them all into one code?
Thanks for the help.
<?php ... ?>block.$transaction_id3 = ($_GET['transaction_id3']!="") ? $_GET['transaction_id3']:'NA';instead of assign the variable and then check<?phptags after each one