Online RSVP form and database with PHP, JavaScript and MySQL


Recently, I needed an online RSVP system for a reception I was hosting, all the options out there didn’t meet my requirements;

  • Customisable and able to self-host
  • No need for tracking codes/numbers to be sent with invitation
  • Able to RSVP additional guests
  • Able to modify an existing RSVP


As usual, I decided to implement my own online RSVP solution, which has the following functionality;
  • PHP/JavaScript front-end
  • MySQL back-end
  • Sleek CSS (borrowed from WordPress)
  • Client-side checking with JavaScript
  • Server-side checking with PHP
  • Very basic submission viewing in HTML, wasn’t a real requirement as I could browse the database with phpMyAdmin, but it was good to have some visibility without the need of logging in


  • You will need PHP installed and a MySQL database.
  • Import the following SQL query to create a RSVP table with required fields.
  • Create a folder on your web hosting.
  • Extract the following zip file contents to this newly created folder.
  • Edit rsvp.php and configure your database settings, including database name, user name, password and host.
  • If using the optional email confirmation, configure the email from address and email body contents.
  • On your website, create an iframe to show the RSVP form.
  • Navigate to rsvp.php and submit a test response.
  • Navigate to res.php and confirm you can see your test response.
  • Alternatively, view the MySQL table directly (with phpMyAdmin)


Two small things I would have added, known after it’s use;

  • Client-side checking for ‘and’ in the full name field, few guests still tried to add themselves and their partner in that field.
  • Improved response email that would be addressed to all guests not just the first name.

VBA automatically saves Excel 2003 Workbook in compatibility mode as Excel 2007 Workbook

Lets say you have a neat little Excel 2003 macro, when you run your macro in Excel 2007, Excel runs it in Compatibility Mode, and any benefits (such as the 16384 columns) you were hoping to use are still unavailable. So how can we enable these benefits depending on the Excel version? Simply by including the following code in the Auto_Open subroutine.

Public Sub auto_open()
    'add some smarts if opened in Excel 2007 or later
    Dim oldFileName As String
    oldFileName = ThisWorkbook.Name
    Dim tempi As Integer 'used to store position of '.' before file extension in workbook file name
    tempi = InStrRev(oldFileName, ".xls", -1, vbTextCompare)
    If Application.Version > 11 And Len(oldFileName) - tempi = 3 Then 'assume running in compatability mode
        Application.DisplayAlerts = False
        Dim newFileName As String
        newFileName = Mid$(oldFileName, 1, tempi) & "xlsm"
        If fileExist(newFileName) Then 'if the new workbook version already exists, then open it and close this one
            'open the new workbook by emulating double clicking the file, as this is the only way to run the auto_open
            Shell "Excel """ & ThisWorkbook.Path & "\" & newFileName & """", 3 '3 = vbMaximizedFocus
            'close this Excel application
        Else 'if the new workbook version doesn't exist, then save it as new workbook version
            'save as macro enables office 2007 workbook
            ActiveWorkbook.SaveAs Filename:=newFileName, FileFormat:=52, CreateBackup:=False '52 = xlOpenXMLWorkbookMacroEnabled
            'create a timer to call the same new workbook as it will be now opened in non compatibility mode
            Application.OnTime Now + TimeValue("00:00:01"), "auto_open"
        End If
        Application.DisplayAlerts = True
    End If
End Sub

Some brief info on how this works, so far the only way I have found to run in Non-Compatibility Mode is to save the Workbook as an Excel Macro Enabled Workbook and reopen the file, or if the file already exists then open that file and close the Excel 2003 Workbook. The main problem is the showing of a UserForm on the reopen or existing open. The bove code is the only way I have found so far, and it involves some trickery. It can be simplified if portions are separated into the Workbook_Activate subroutine, but I wanted to provide a copy and paste solution with minimal fiddling around. The only change in the above code is the UserForm1 name.

One of the problems was the Workbook_Activate or Auto_open not running when called via the normal Open method. I actually had to ask ExpertsExchange, the expert was very helpful.

Any comments or suggestions welcome as always.