Jump to content

custom form in custom page


keneso

Recommended Posts

Hi,

 

I have created a custom page, and need to add a custom form to it.

I tried adding the form to the page, but I get some of the custom php displayed, most probably is because my custom form has honeypot field, and time limit with this in the header:

<?php
session_start();
$_SESSION['time'] = time();
$sol = array();
for($i=1;$i<=3;$i++):
$sol[] = rand(1,9);
endfor;
$_SESSION['sol'] = array_sum($sol);
//print_r($_SESSION['sol']);
?>
<!DOCTYPE html>

 

The code in the form is this

<?php if(isset($_SESSION['lastname'])){ echo $_SESSION['lastname'];}?>

 

And the output in the page (inside the field) is this

<?php if(isset($_SESSION['lastname']))?>

 

Of course the same is with other fields.

 

Or maybe there is a much easier way to do it using WHMCS settings?

 

Thank you

Link to comment
Share on other sites

  • 1 month later...

If you are putting this code on a WHMCS page (i.e. in a TPL file) then you would need to use these tags to open and close PHP:

 

{php}

 

{/php}

 

So instead of this:

 

<?php if(isset($_SESSION['lastname']))?>

 

You would use this:

 

{php} if(isset($_SESSION['lastname'])){/php}

Link to comment
Share on other sites

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.   Paste as plain text instead

  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.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated