Hello. I am trying to edit my event registration site so that after the registration cut off date, the link will no longer be valid and it will display "registration closed" I cannot figure out the syntax error here.

<?
if ($registerend < NOW()){
print "Registration has ended";
}else{
print " <a href=\"/registration/new/register.php?id=<?php echo $event["id"]?>\">Click Here to Register</a>;
}
?>

Any suggestions?

Recommended Answers

All 3 Replies

It looks as if you have tried to embed a PHP statement within a section of PHP code. On the last Print statement you don't need:
...<?PHP echo ...?>...
try
...php?id=".$event["id"]."\"> ...

NOW() is an sql mysql mssql function not a php fuction in php time() is now
as well as the slightly buggy print code

<?
if ($registerend < time()){
print "Registration has ended";
}else{
print " <a href='/registration/new/register.php?id=".$event['id']."'>Click Here to Register</a>";
} ?>

Its possibly more portable, for more than one event running at close to the same times, to use the event array to hold all the relevant data for each event

if ( $event['registerend'] <time()) {/* code */ }

well I hope you get busy enough to need more than one event running at a time

Thank you! It is working perfectly.

We are getting to the point where end dates are getting close.

Thank you again.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.