Forums

Writing to db and redirect on submit

kdbates 01 Apr, 2011
Hello,

I am working on a job application (multi page) form. I am having difficulty getting data to write to my database. I have followed the tutorials and any documentation I could find including setting up the multiPage plugin. Here are the details:
form 1 is here: http://www.pmpizza.com/job/employment/application/133-employment-application.html

After hitting the next button, you should be redirected to the next form at
http://www.pmpizza.com/job/employment/application/131-age-availability.html


However, the first form just refreshes and comes back empty with no data being written to my table.
Here is my form code
<div class="cf_item"> <h2 class="cf_text">Employment Application</h2> </div>

<div class="cf_item" style="width: 580px;"> <span class="cf_text">Please fill out this application for employment at one of the three Papa Murphy's locations in Bend or Redmond Oregon</span> </div>
<table width="570" border="0">
<tr>
<td width="100"><div class="cf_item">
  <h3 class="cf_title" style="width: 150px;">First Name*:</h3>
  <div class="cf_fields">
    <input name="fname" type="text" value="" title="Please tell us your first name." class="cf_inputtext cf_inputbox required" maxlength="150" size="30" id="fname" />
    <br />
    <label class="cf_botLabel"></label>
  </div>
</div></td>
<td width="100"><div class="cf_item" style="width: 100px;">
  <h3 class="cf_title" style="width: 100px;">Middle Int.:</h3>
  <div class="cf_fields">
    <input name="mi" type="text" value="" title="Please tell us your middle initial" class="cf_inputtext cf_inputbox required" maxlength="150" size="10" id="mi" />
    <br />
    <label class="cf_botLabel"></label>
  </div>
</div></td>
<td><div class="cf_item">
  <h3 class="cf_title" style="width: 150px;">Last Name*:</h3>
  <div class="cf_fields">
    <input name="lname" type="text" value="" title="Please tell us your last name" class="cf_inputtext cf_inputbox required" maxlength="150" size="30" id="lname" />
    <br />
    <label class="cf_botLabel"></label>
  </div>
</div></td>
</tr>
<tr>
<td><div class="cf_item">
  <h3 class="cf_title" style="width: 150px;">Phone type:</h3>
  <div class="cf_fields">
    <select class="cf_select cf_inputbox" id="phonetype" title="" size="1"  name="phonetype">
      <option value="">Please select phone type</option>
      
        <option value="Home Phone">Home Phone</option>
      

        <option value="Mobile Phone">Mobile Phone</option>
      

        <option value="Work Phone">Work Phone</option>
    </select>
    <br />
    <label class="cf_botLabel"></label>
  </div>
</div></td>
<td><div class="cf_item">
  <h3 class="cf_title" style="width: 150px;">Phone*:</h3>
  <div class="cf_fields">
    <input name="phone" type="text" value="" title="What phone number can we call you at?" class="cf_inputtext cf_inputbox required" maxlength="150" size="30" id="phone" />
    <br />
    <label class="cf_botLabel"></label>
  </div>
</div></td>
<td><div class="cf_item">
  <h3 class="cf_title" style="width: 150px;">Email*:</h3>
  <div class="cf_fields">
    <input name="email" type="text" value="" title="Please give us a valid email address" class="cf_inputtext cf_inputbox required validate-email" maxlength="150" size="30" id="email" />
    <br />
    <label class="cf_botLabel"></label>
  </div>
</div></td>
</tr>
<tr>
<td colspan="2" valign="bottom"><div class="cf_item">
  <h3 class="cf_title" style="width: 150px;">Street Address:</h3>
  <div class="cf_fields">
    <input name="streetnumber" type="text" value="Street Number" title="" class="cf_inputtext cf_inputbox" maxlength="300" size="60" id="streetnumber" />
    <br />
    <label class="cf_botLabel"></label>
  </div>
</div></td>
<td valign="bottom"><div class="cf_item">
  <h3 class="cf_title" style="display: none;">Apt. Number:</h3>
  <div class="cf_fields">
    <input name="apt" type="text" value="Apt. Number" title="" class="cf_inputtext cf_inputbox" maxlength="150" size="30" id="apt" />
    <br />
    <label class="cf_botLabel"></label>
  </div>
</div></td>
</tr>
<tr>
<td><div class="cf_item">
  <h3 class="cf_title" style="display: none;">City</h3>
  <div class="cf_fields">
    <input name="city" type="text" value="City" title="" class="cf_inputtext cf_inputbox" maxlength="150" size="30" id="city" />
    <br />
    <label class="cf_botLabel"></label>
  </div>
</div></td>
<td><div class="cf_item">
  <h3 class="cf_title" style="display: none;">State:</h3>
  <div class="cf_fields">
    <input name="state" type="text" value="St." title="" class="cf_inputtext cf_inputbox" maxlength="5" size="5" id="state" />
    <br />

    <label class="cf_botLabel"></label>
  </div>
</div></td>
<td><div class="cf_item">
  <h3 class="cf_title" style="display: none;">Zip:</h3>
  <div class="cf_fields">
    <input name="zip" type="text" value="Zip" title="" class="cf_inputtext cf_inputbox" maxlength="10" size="10" id="zip" />
    <br />
    <label class="cf_botLabel"></label>
  </div>
</div></td>
</tr>
<tr>
<td>
<div class="cf_item">
  <input value="SAVE step 1 of 5" name="button_21" type="submit" />
</div>

</td>
<td> </td>
<td> </td>
</tr>
</table>


Any feedback would be greatly appreciated.
Thanks!
keivn
GreyHead 02 Apr, 2011
Hi Kdbates,

There's an error on the form page:

Parse error: syntax error, unexpected '$', expecting T_VARIABLE in /home/pmpizza/public_html/components/com_chronocontact/chronocontact.php(52) : eval()'d code on line 64

This usually means that there is a problem reading the column names from the table you are saving to. Does the table name or any of the column names have a dash, space or other special character in it?

For the redirect URL it safer to use the non-sef version in the box and you don't think you need the onSubmit() entry (it just isn't doing anything there).

It's not clear to me if you are using the Multi-Page plug-in? I think not. It is a much better way of building multi-page forms that trying to do it from scratch. If you are new to the plug-in test it out with a couple of very simple forms to get familiar with the way it works; then rebuild with the full forms.

Bob
This topic is locked and no more replies can be posted.