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='myname@mydomain.com';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: myname@mydomain.com[/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? Quote Link to comment Share on other sites More sharing options...
marcus Posted November 11, 2006 Share Posted November 11, 2006 [code]if(!$Email){$Email = "defaultemail@email.tld";};[/code] Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.