Jump to content

[SOLVED] PHP not Posting to SQL, but fine in return email?


tapupartforpres

Recommended Posts

Hello.

 

I have a question.  I have a form that is not posting some fields to the SQL database.  When I get the return email it shows the fields were filled out?  Other fields are posting to the SQL fine.  I was wondering if someone can help.  I think I just have been looking at this too long.  Thanks

 

The fields that are not posting to the SQL are "q3_answer", "q4_answer", "q6_answer", and "q6".  Other fields are ok.

 

In the SQL "q3_answer", "q4_answer", "q6_answer" are set as "VARCAR" with 244 length (Null set to YES)

 

Also, the "q6" is also set to "VARCAR" with 11 length (Null set to YES)

 

PHP Code

 

<?php
$con = mysql_connect("xxx.xxx.xxx.xxx","login","xxxxxxxxx");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("xxxxxxxxxxxxxx", $con);
$q1=mysql_real_escape_string($_POST['q1']);

$q2_1=mysql_real_escape_string($_POST['q2_1']);
$q2_2=mysql_real_escape_string($_POST['q2_2']); 
$q2_3=mysql_real_escape_string($_POST['q2_3']); 
$q2_4=mysql_real_escape_string($_POST['q2_4']); 
$q2_5=mysql_real_escape_string($_POST['q2_5']); 
$q2_6=mysql_real_escape_string($_POST['q2_6']); 
$q2_7=mysql_real_escape_string($_POST['q2_7']); 
$q2_8=mysql_real_escape_string($_POST['q2_8']); 
$q2_9=mysql_real_escape_string($_POST['q2_9']); 
$q2_10=mysql_real_escape_string($_POST['q2_10']); 
$q2_11=mysql_real_escape_string($_POST['q2_11']); 
$q2_12=mysql_real_escape_string($_POST['q2_12']); 
$q3=mysql_real_escape_string($_POST['q3']); 
$q3_answer=mysql_real_escape_string($_POST['q3_answer']); 
$q4=mysql_real_escape_string($_POST['q4']); 
$q4_answer=mysql_real_escape_string($_POST['q4_answer']); 
$q5=mysql_real_escape_string($_POST['q5']); 
$q6=mysql_real_escape_string($_POST['q6']);
$q6_answer=mysql_real_escape_string($_POST['q6_answer']); 
$name=mysql_real_escape_string($_POST['name']); 
$company=mysql_real_escape_string($_POST['company']);
$address=mysql_real_escape_string($_POST['address']);
$city=mysql_real_escape_string($_POST['city']);
$zip=mysql_real_escape_string($_POST['zip']);
$email=mysql_real_escape_string($_POST['email']);
$state=mysql_real_escape_string($_POST['state']);
$phone=mysql_real_escape_string($_POST['phone']);
$q8=mysql_real_escape_string($_POST['q8']);
$q9=mysql_real_escape_string($_POST['q9']);


$sql="INSERT INTO amplify_event_answers (q1,q2_1,q2_2,q2_3,q2_4,q2_5,q2_6,q2_7,q2_8,q2_9,q2_10,q2_11,q2_12,q3,q3_answer,q4,q4_answer,q5,q6,q6_answer,name,company,address,city,state,zip,email,phone,q8,q9) 

VALUES ('$q1','$q2_1','$q2_2','$q2_3','$q2_4','$q2_5','$q2_6','$q2_7','$q2_8','$q2_9','$q2_10','$q2_11','$q2_12','$q3','$q3_answer','$q4','$q4_answer','$q5','$q6','$q6_answer','$name','$company','$address','$city','$state','$zip','$email','$phone','$q8','$q9')"; 
if (!mysql_query($sql,$con)) {
die('Error: ' . mysql_error());
}

mysql_close($con);

 

 

HTML (I know it's sloppy)

 

<img src="images/New_amplify-register_02_01.jpg" width="800" height="46" />
  <form class="amplify_questions" enctype="multipart/form-data" method="post" action="amp_questions.php">
    <blockquote>
      <blockquote>
        <p class="body_text"><strong>1</strong>. How many business connections did you make at the event?</p>
        <p class="body_text">
            <textarea name="q1" cols="82" rows="3" id="q1" tabindex="10"></textarea>
      <br/>
                  </p>
        <p class="body_text"> </p>
        <p class="body_text"><strong>2. </strong>Please rate the following.      </p>
      </blockquote>
    </blockquote>
    <blockquote>
      <blockquote>
        <table width="666" border="0" cellpadding="0" cellspacing="0">
          <tr>
            <td width="304" height="28"> </td>
            <td width="69"><div align="center">Very Satisfied</div></td>
            <td width="70"><div align="center">Satisfied</div></td>
            <td width="76"><div align="center">Neutral</div></td>
            <td width="75"><p align="center">Dissatisfied</p></td>
            <td width="72"><div align="center">Very Dissatisfied</div></td>
          </tr>
          <tr>
            <td height="24"><p align="left" class="style2">Registration Process</p></td>
            <td><div align="center">
              <label>
                <input type="radio" name="q2_1" id="q2_1" value="1" />
                </label>
            </div></td>
            <td><div align="center">
              <input type="radio" name="q2_1" id="q2_1" value="2" />
            </div></td>
            <td><div align="center">
              <input type="radio" name="q2_1" id="q2_1" value="3" />
            </div></td>
            <td><div align="center">
              <input type="radio" name="q2_1" id="q2_1" value="4" />
            </div></td>
            <td><div align="center">
              <input type="radio" name="q2_1" id="q2_1" value="5" />
            </div></td>
          </tr>
          <tr>
            <td><p align="left" class="style2">Networking Opportunity</p></td>
            <td><div align="center">
                <label>
                <input type="radio" name="q2_2" id="q2_2" value="1" />
                </label>
            </div></td>
            <td><div align="center">
                <input type="radio" name="q2_2" id="q2_2" value="2" />
            </div></td>
            <td><div align="center">
                <input type="radio" name="q2_2" id="q2_2" value="3" />
            </div></td>
            <td><div align="center">
                <input type="radio" name="q2_2" id="q2_2" value="4" />
            </div></td>
            <td><div align="center">
                <input type="radio" name="q2_2" id="q2_2" value="5" />
            </div></td>
          </tr>
          <tr>
            <td><p align="left" class="style2">Food/Beverage </p></td>
            <td><div align="center">
                <label>
                <input type="radio" name="q2_3" id="q2_3" value="1" />
                </label>
            </div></td>
            <td><div align="center">
                <input type="radio" name="q2_3" id="q2_3" value="2" />
            </div></td>
            <td><div align="center">
                <input type="radio" name="q2_3" id="q2_3" value="3" />
            </div></td>
            <td><div align="center">
                <input type="radio" name="q2_3" id="q2_3" value="4" />
            </div></td>
            <td><div align="center">
                <input type="radio" name="q2_3" id="q2_3" value="5" />
            </div></td>
          </tr>
          <tr>
            <td><p align="left" class="style2">Goody Bag</p></td>
            <td><div align="center">
                <label>
                <input type="radio" name="q2_4" id="q2_4" value="1" />
                </label>
            </div></td>
            <td><div align="center">
                <input type="radio" name="q2_4" id="q2_4" value="2" />
            </div></td>
            <td><div align="center">
                <input type="radio" name="q2_4" id="q2_4" value="3" />
            </div></td>
            <td><div align="center">
                <input type="radio" name="q2_4" id="q2_4" value="4" />
            </div></td>
            <td><div align="center">
                <input type="radio" name="q2_4" id="q2_4" value="5" />
            </div></td>
          </tr>
          <tr>
            <td><p align="left" class="style2">Door Prizes</p></td>
            <td><div align="center">
                <label>
                <input type="radio" name="q2_5" id="q2_5" value="1" />
                </label>
            </div></td>
            <td><div align="center">
                <input type="radio" name="q2_5" id="q2_5" value="2" />
            </div></td>
            <td><div align="center">
                <input type="radio" name="q2_5" id="q2_5" value="3" />
            </div></td>
            <td><div align="center">
                <input type="radio" name="q2_5" id="q2_5" value="4" />
            </div></td>
            <td><div align="center">
                <input type="radio" name="q2_5" id="q2_5" value="5" />
            </div></td>
          </tr>
          <tr>
            <td><p align="left" class="style2">Moderator Scott McFarland</p></td>
            <td><div align="center">
                <label>
                <input type="radio" name="q2_6" id="q2_6" value="1" />
                </label>
            </div></td>
            <td><div align="center">
                <input type="radio" name="q2_6" id="q2_6" value="2" />
            </div></td>
            <td><div align="center">
                <input type="radio" name="q2_6" id="q2_6" value="3" />
            </div></td>
            <td><div align="center">
                <input type="radio" name="q2_6" id="q2_6" value="4" />
            </div></td>
            <td><div align="center">
                <input type="radio" name="q2_6" id="q2_6" value="5" />
            </div></td>
          </tr>
          <tr>
            <td><p align="left" class="style2">The Silver Grill</p></td>
            <td><div align="center">
                <label>
                <input type="radio" name="q2_7" id="q2_7" value="1" />
                </label>
            </div></td>
            <td><div align="center">
                <input type="radio" name="q2_7" id="q2_7" value="2" />
            </div></td>
            <td><div align="center">
                <input type="radio" name="q2_7" id="q2_7" value="3" />
            </div></td>
            <td><div align="center">
                <input type="radio" name="q2_7" id="q2_7" value="4" />
            </div></td>
            <td><div align="center">
                <input type="radio" name="q2_7" id="q2_7" value="5" />
            </div></td>
          </tr>
          <tr>
            <td><p align="left" class="style2">Panelists</p></td>
            <td><div align="center">
                <label>
                <input type="radio" name="q2_8" id="q2_8" value="1" />
                </label>
            </div></td>
            <td><div align="center">
                <input type="radio" name="q2_8" id="q2_8" value="2" />
            </div></td>
            <td><div align="center">
                <input type="radio" name="q2_8" id="q2_8" value="3" />
            </div></td>
            <td><div align="center">
                <input type="radio" name="q2_8" id="q2_8" value="4" />
            </div></td>
            <td><div align="center">
                <input type="radio" name="q2_8" id="q2_8" value="5" />
            </div></td>
          </tr>
          <tr>
            <td><p align="left" class="style2">Parking</p></td>
            <td><div align="center">
                <label>
                <input type="radio" name="q2_9" id="q2_9" value="1" />
                </label>
            </div></td>
            <td><div align="center">
                <input type="radio" name="q2_9" id="q2_9" value="2" />
            </div></td>
            <td><div align="center">
                <input type="radio" name="q2_9" id="q2_9" value="3" />
            </div></td>
            <td><div align="center">
                <input type="radio" name="q2_9" id="q2_9" value="4" />
            </div></td>
            <td><div align="center">
                <input type="radio" name="q2_9" id="q2_9" value="5" />
            </div></td>
          </tr>
          <tr>
            <td height="22"><p align="left" class="style2">Interactive Polling by Assessment Technologies</p></td>
            <td><div align="center">
                <label>
                <input type="radio" name="q2_10" id="q2_10" value="1" />
                </label>
            </div></td>
            <td><div align="center">
                <input type="radio" name="q2_10" id="q2_10" value="2" />
            </div></td>
            <td><div align="center">
                <input type="radio" name="q2_10" id="q2_10" value="3" />
            </div></td>
            <td><div align="center">
                <input type="radio" name="q2_10" id="q2_10" value="4" />
            </div></td>
            <td><div align="center">
                <input type="radio" name="q2_10" id="q2_10" value="5" />
            </div></td>
          </tr>
          <tr>
            <td><p align="left" class="style2">Topics Discussed</p></td>
            <td><div align="center">
                <label>
                <input type="radio" name="q2_11" id="q2_11" value="1" />
                </label>
            </div></td>
            <td><div align="center">
                <input type="radio" name="q2_11" id="q2_11" value="2" />
            </div></td>
            <td><div align="center">
                <input type="radio" name="q2_11" id="q2_11" value="3" />
            </div></td>
            <td><div align="center">
                <input type="radio" name="q2_11" id="q2_11" value="4" />
            </div></td>
            <td><div align="center">
                <input type="radio" name="q2_11" id="q2_11" value="5" />
            </div></td>
          </tr>
          <tr>
            <td><p align="left" class="style2">Overall</p></td>
            <td><div align="center">
                <label>
                <input type="radio" name="q2_12" id="q2_12" value="1" />
                </label>
            </div></td>
            <td><div align="center">
                <input type="radio" name="q2_12" id="q2_12" value="2" />
            </div></td>
            <td><div align="center">
                <input type="radio" name="q2_12" id="q2_12" value="3" />
            </div></td>
            <td><div align="center">
                <input type="radio" name="q2_12" id="q2_12" value="4" />
            </div></td>
            <td><div align="center">
                <input type="radio" name="q2_12" id="q2_12" value="5" />
            </div></td>
          </tr>
        </table>
        <p class="body_text"><br />
          <strong>3</strong>.  How did you learn of the event? </p>
        
          <p>
            <input name="q3" type="radio" class="oneColLiqCtrHdr" id="q3" value="3a" />
          Advertisement in CBC Magazine<br />
          <input name="q3" type="radio" class="oneColLiqCtrHdr" id="q3" value="3b" />
          E-mail from Contemporary Design Group/CBC Magazine<br />
          <input type="radio" name="q3" id="q3" value="3c" />
          Corporate College<br />
          <input type="radio" name="q3" id="q3" value="3d" />
          Allen Graphics<br />
          <input type="radio" name="q3" id="q3" value="3e"/>
          107.3 THE WAVE          <br />
          <input type="radio" name="q3" id="q3" value="3f"/>
          Women In Networking<br />
          <input type="radio" name="q3" id="q3" value="3g"/>
          Suntrol<br />
          <input type="radio" name="q3" id="q3" value="3h"/>
          Modern International Graphics<br />
          <input type="radio" name="q3" id="q3" value="3i"/> 
          Repros Color<br />
          <input type="radio" name="q3" id="q3" value="3j" />
          Food For Thought <br />
          <input type="radio" name="q3" id="q3" value="3k"/>
          Dr. Raj <br />
          <input type="radio" name="q3" id="q3" value="3l"/>
          Colortone Staging and Rentals <br />
          <input type="radio" name="q3" id="q3" value="3m"/>
        The Cleveland Indians<br/>
        <input type="radio" name="q3" id="q3" value="3n"/> 
        Other (please specify) 
       <input name="q3_answer" type="text" id="q3_answer" size="55" maxlength="244" />
      
          </p>
          <p><strong class="body_text">4</strong>. Would you attend another AMPLIFY Speaker Event?
            <input name="q4" type="radio" id="q4" value="y" />
          Yes
          <input name="q4" type="radio" id="q4" value="n" />
          No
          </p>
          If no, why not?
            <input name="q4_answer" type="text" id="q4_answer" size="55" maxlength="244" />
          
          <p><strong class="body_text">5</strong>. Would your company benefit from a design consultation with Contemporary Design Group?
            <input name="q5" type="radio" id="q5" value="y" />
Yes
<input name="q5" type="radio" id="q5" value="n" />
No</p>
          <p class="body_text"><br />
              <strong>6</strong>.  How do you receive CBC Magazine?</p>
          <p>
            <input name="q6" type="radio" id="6" value="6a" />
            I am a paid subscriber<br />
  <input name="q6" type="radio" id="6" value="6b" />
  I receive the magazine complimentary<br />
  <input name="q6" type="radio" id="6" value="6c" />
  I am an advertiser<br />
  <input name="q6" type="radio" id="6" value="6d" />
  I do not receive CBC Magazine<br />
  <input name="q6" type="radio" id="6" value="6e" />
  I would like to receive CBC Magazine <br />
  <input type="radio" name="q6" id="6" value="6f" />
            Other (please specify)
  <input name="q6_answer" type="text" id="q6_answer" size="55" maxlength="244" />
          </p>
          <p><strong>7</strong>. Please complete the information below. </p>
          <table width="666" border="0" cellspacing="0" cellpadding="0">
            <tr>
              <td width="58" height="36">Name:</td>
              <td width="274"><input name="name" type="text" id="name" size="33" maxlength="66" /></td>
              <td width="58">Company</td>
              <td width="276"><input name="company" type="text" id="company" size="33" maxlength="66" /></td>
            </tr>
            <tr>
              <td height="35">Address</td>
              <td><input name="address" type="text" id="address" size="33" maxlength="66" /></td>
              <td>City/Town</td>
              <td><input name="city" type="text" id="city" size="33" maxlength="66" /></td>
            </tr>
            <tr>
              <td height="33">State</td>
              <td><input name="state" type="text" id="state" size="33" maxlength="66" /></td>
              <td>Zip</td>
              <td><input name="zip" type="text" id="zip" size="33" maxlength="66" /></td>
            </tr>
            <tr>
              <td height="39">E-Mail</td>
              <td><input name="email" type="text" id="email" size="33" maxlength="66" /></td>
              <td>Phone</td>
              <td><input name="phone" type="text" id="phone" size="33" maxlength="66" /></td>
            </tr>
          </table>
          <p><strong class="body_text">8</strong>. Would you like to share your information to network with other event attendees?
            <input name="q8" type="radio" id="q8" value="y" />
Yes
<input name="q8" type="radio" id="q8" value="n" />
No</p>
          <p><strong class="body_text">9</strong>. Would you like to receive the results of the events interactive polls?
            <input type="radio" name="q9" id="q9" value="y"/>
Yes
<input type="radio" name="q9" id="q9" value="n"/>
No <br />
          </p>
      </blockquote>
      </blockquote>
    <p align="center">
      <input type="submit" id="submit" value="Submit" />    
      </p>
  </form>

 

 

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.