Jump to content

Adding an echo to a $variable


unistake

Recommended Posts

Hi all,

 

I am trying to add the echo " AND "; below to the variable $model if the $_POST['purchasetype'] has a value.

 

how can you add echos within IF statements to a variable, if at all possible?

 

Many thanks,

 

 

<?php
if ($_POST[model] !="") {
$model = "model='". $_POST['model'] ."'"; if ($_POST['purchasetype'] !="") { echo " AND "; }
}
else { $model = ""; }
?>

Link to comment
https://forums.phpfreaks.com/topic/216019-adding-an-echo-to-a-variable/
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.