No announcement yet.

PHP Eval for contact Form submit error

  • Filter
  • Time
  • Show
Clear All
new posts

  • [CMS] PHP Eval for contact Form submit error

    I'm trying to create a page with the CMS software using PHP Direct Eval option. The code I'm using is here:

    PHP Code:
    if (!isset($_POST['contact_form_submit']) && empty($_POST['contact_form_submit'])){
    $output = <<<HERE
            <form action='' method='post' id='contact_form'>
                        <td>Message Topic:</td>
                        <td><select name='topic'>
                            <option value=''>Pick a Topic</option>
                            <option value='general'>General Question</option>
                            <option value='membership'>Membership Question</option>
                            <option value='website'>Website Issue</option>
                            <option value='other'>Other</option>
                        <td>Email Address:</td>
                        <td><input type='text' name='email' /></td>
                        <td><textarea name='message' cols='40' rows='10'></textarea></td>
                <input type='hidden' name='securitytoken' value='
    {$vbulletin->userinfo['securitytoken']}' />
                <center><input type='submit' name='contact_form_submit' value='Send Question' /></center>

    When I submit this code, I get the following error:
    Your submission could not be processed because a security token was missing.

    If this occurred unexpectedly, please inform the administrator and describe the action you performed before you received this error
    What am I missing?

    ALSO, there is a bug in the edit form within the CMS when editing PHP. The above code is rendered as shown in the attached image.

    Click image for larger version

Name:	Screen shot 2011-04-15 at 07.52.58.png
Views:	1
Size:	59.2 KB
ID:	3720359

  • #2
    If you look at the contactus template, you'll see an example of what you'll need:

    <input type="hidden" name="securitytoken" value="{vb:raw bbuserinfo.securitytoken}" />

    Re the Bug, what browser are you using as I don't get that in 4.1.3 using Firefox...
    Vote for:

    - *Admin Settable Paid Subscription Reminder Timeframe*
    *PM - Add ability to reply to originator only*
    - Add Admin ability to auto-subscribe users to specific channel(s)
    - "Quick Route" Interface...


    • #3
      What is this stuff doing in there - "<<<HERE" and "HERE;" ? Those are going to cause problems because your html (in the php) is invalid.

      Please don't PM or VM me for support - I only help out in the threads.
      vBulletin Manual & vBulletin 4.0 Code Documentation (API)
      Want help modifying your vbulletin forum? Head on over to
      If I post CSS and you don't know where it goes, throw it into the additional.css template.

      W3Schools &lt;- awesome site for html/css help


      • #4

        Please do some research on 'heredoc' in the PHP manual. It's actually not even unique to PHP, but is found in Perl, C, C++, Java, and many other languages. I see there are a few errors in my HTML above, namely the missing '>' for the select, and some closing tags near the bottom. I appreciate your attempt to help, but you've failed to give me any criticism that's actually constructive and helps me solve my problem.


        What you have there is exactly what I needed, I just didn't know where to look. Thanks for the info! I'm using Safari on the Mac where I see that bug. I'll check out a couple other browsers (Mac, Windows, *nix) and get back to you on my bug. I will make sure to try my faulty HTML above, as it's possible the vB code is properly escaping my code to render the page, errors and all.


        • #5
          The code required is a little different than what Trevor showed, as I just ran into this error today when helping someone else out. Here is a link to the proper code:


          • #6
            What I see there is what I already have. The syntax in the link is wrong.


            • #7
              Well, it worked for me.


              • #8
                I had the same? problem, cused by Keepalive being disabled in Apache. Enabling KeepAlive solved my problems. Apache KeepAlive is normally enabled by default.


                widgetinstance 262 (Related Topics) skipped due to lack of content & hide_module_if_empty option.