Jump to content

Recommended Posts

I switched over to yahoo hosting and alot of the php I was using elsewhere now no longer works, if someone could take a look and tell me any problems they see that would be nice!
[code]<?php
echo date("4 November 2006");
echo "<br>";
  $d=date("D");
  if ($d=="Fri")
echo "Have a nice weekend!";
    else
echo "Have a nice day!";
echo "<BR>";
?>

<p style="color:White">
<div ALIGN=CENTER><h3><?php
if (isset($_POST['name'])) echo "
Welcome <B>$_POST[name] !</B>\n";
?></p></div></h3>[/code]
Link to comment
https://forums.phpfreaks.com/topic/26185-what-is-wrong-with-this-code/
Share on other sites

Your Problem lies in...

if (isset($_POST['name'])) echo "
Welcome <B>$_POST[name] !</B>\n";

change that to

[code]
if (isset($_POST['name'])){
echo "
Welcome <B>$_POST[name] !</B>\n";
};
[/code]


You are missing the { } that surround the echo!
you don't need brackets when you only have one statement after your IF

if ($blah)
  echo "yep";
else
  echo "nope";


jwilh, are you getting any errors whatsoever
if not put this line at the top of your script
error_reporting(E_ALL);

and if it's not errors you get
What not working the way you want it to

and the first and only thing I see wrong with your code so far is this
echo date("4 November 2006");

it should be
echo date("d M Y", strtotime("4 November 2006"));

which is pointless cuz you might as well just say
echo "4 November 2006";
This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.