greggustin Posted November 11, 2006 Share Posted November 11, 2006 I want to preset variables in case users leave certain fields blank in a html formeg $email='[email protected]';then php has the following:$Email=$_POST['Email'];echo "Email : ".$Email."<p>";if the user leaves the field empty, I want it to echo[color=red]Email: [email protected][/color]BUTit does this -->[color=red][font=Verdana]Email: [/font][/color](ie nothing)soooooooooo, am I stuck doing a IF test for each post?that is, if post is empty, then set the variable to the desired default value? Link to comment https://forums.phpfreaks.com/topic/26896-initialize-varaibles/ Share on other sites More sharing options...
marcus Posted November 11, 2006 Share Posted November 11, 2006 [code]if(!$Email){$Email = "[email protected]";};[/code] Link to comment https://forums.phpfreaks.com/topic/26896-initialize-varaibles/#findComment-122995 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.