array(
“Release Year” => “2021”,
“Display” => “6.7-inch Super Retina XDR OLED”,
“Chipset” => “Apple A15 Bionic”,
“Camera” => “Triple 12MP”,
“Battery” => “4352 mAh”,
“OS at Launch” => “iOS 15”
),
“iPhone 14 Pro” => array(
“Release Year” => “2022”,
“Display” => “6.1-inch Super Retina XDR OLED, 120Hz”,
“Chipset” => “Apple A16 Bionic”,
“Camera” => “48MP + 12MP + 12MP”,
“Battery” => “3200 mAh”,
“OS at Launch” => “iOS 16”
)
);
$output = ‘
‘;
if (isset($_POST[‘iphone_model’])) {
$model = sanitize_text_field($_POST[‘iphone_model’]);
if (array_key_exists($model, $iphone_data)) {
$output .= “
Results for $model:
- “;
- $key: $value
foreach ($iphone_data[$model] as $key => $value) {
$output .= “
“;
}
$output .= “
“;
} else {
$output .= “
No info found for $model.
“;
}
}
return $output;
}
add_shortcode(‘iphone_info_tool’, ‘iphone_info_tool_form’);
Leave a Reply