SitePoint Sponsor

User Tag List

Results 1 to 6 of 6
  1. #1
    SitePoint Wizard billy_111's Avatar
    Join Date
    Jul 2009
    Posts
    1,683
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Why does this form not submit?

    Hey,

    I have the following code but it does not submit? Any ideas what i am doing wrong..

    PHP Code:
                <?php
                        
    if(isset($_POST['btn-submit']))
                        {
                        include(
    "../conn.php");    
                                        
                        
    $insert "INSERT INTO tbl_rate_company(job_review_id, 
                        member_id, job_security, training, career_program, 
                        quality, quality_management, benefits, overall, 
                        exptected, performance, recommend, 
                        loyal, date_added) 
                        VALUES 
                        (
                        '"
    .$_SESSION['review_id']."', 
                                           //insert here....
                        )"
    ;
                        
    $add_member mysql_query($insert);
                                                                    
                        
    header("Location: http://www.judgethejob.com/vinny/submit-review-3/");                                
                        }    
                    
    ?>

                    <form action="" id="advertise" method="post" class="AdvancedForm">
                                <fieldset>
                        <p><strong>Rate the following: 1 (Very dissatisfactory) - 5 (Very satisfactory)</strong></p>
                        
                        <table class="table">
                        <tr>
                        <td>1</td><td>2</td><td>3</td><td>4</td><td>5</td>
                        </tr>
                        </table>
                                <br />
                        <ul>
                            <li>
                                <label for="name" style="width: 396px; font-weight:normal; height: 16px;">Job security</label>
                                <span id="ValidRadio1" class="InputGroup">
                                <input type="radio" name="01" value="1" style="width: 37px; height: 18px" id="ValidRadio_1"/>
                                <input type="radio" name="01" value="2" style="width: 41px; height: 18px" id="ValidRadio_2"/>
                                <input type="radio" name="01" value="3" style="width: 42px; height: 18px" id="ValidRadio_3"/>
                                <input type="radio" name="01" value="4" style="width: 42px; height: 18px" id="ValidRadio_4"/>
                                <input type="radio" name="01" value="5" style="width: 37px; height: 18px"id="ValidRadio_5"/>
                                </span>
                            </li>
                            <li>
                                <label for="name" style="width: 396px; font-weight:normal">Work life balance</label>
                                <span id="ValidRadio2" class="InputGroup">
                                <input type="radio" name="02" value="1" style="width: 37px; height: 18px" id="ValidRadio_1"/>
                                <input type="radio" name="02" value="2" style="width: 41px; height: 18px" id="ValidRadio_2"/>
                                <input type="radio" name="02" value="3" style="width: 42px; height: 18px" id="ValidRadio_3"/>
                                <input type="radio" name="02" value="4" style="width: 42px; height: 18px" id="ValidRadio_4"/>
                                <input type="radio" name="02" value="5" style="width: 37px; height: 18px"id="ValidRadio_5"/>
                                </span>
                            </li>
                            <li>
                                <label for="name" style="width: 396px;font-weight:normal">Training</label>
                                <span id="ValidRadio3" class="InputGroup">
                                <input type="radio" name="03" value="1" style="width: 37px; height: 18px" id="ValidRadio_1"/>
                                <input type="radio" name="03" value="2" style="width: 41px; height: 18px" id="ValidRadio_2"/>
                                <input type="radio" name="03" value="3" style="width: 42px; height: 18px" id="ValidRadio_3"/>
                                <input type="radio" name="03" value="4" style="width: 42px; height: 18px" id="ValidRadio_4"/>
                                <input type="radio" name="05" value="5" style="width: 37px; height: 18px"id="ValidRadio_5"/>
                                </span>
                            </li>
                            <li style="height: 20px">
                            <label for="name" style="width: 396px;font-weight:normal">Career progression <small>(aware of opportunities? confident you can develop?)</small></label>
                                <span id="ValidRadio4" class="InputGroup">
                                <input type="radio" name="04" value="1" style="width: 37px; height: 18px" id="ValidRadio_1"/>
                                <input type="radio" name="04" value="2" style="width: 41px; height: 18px" id="ValidRadio_2"/>
                                <input type="radio" name="04" value="3" style="width: 42px; height: 18px" id="ValidRadio_3"/>
                                <input type="radio" name="04" value="4" style="width: 42px; height: 18px" id="ValidRadio_4"/>
                                <input type="radio" name="04" value="5" style="width: 37px; height: 18px"id="ValidRadio_5"/>
                                </span>
                            </li>
                            <li>
                            <label for="name" style="width: 396px;font-weight:normal">Quality of management</label>
                                <span id="ValidRadio5" class="InputGroup">
                                <input type="radio" name="05" value="1" style="width: 37px; height: 18px" id="ValidRadio_1"/>
                                <input type="radio" name="05" value="2" style="width: 41px; height: 18px" id="ValidRadio_2"/>
                                <input type="radio" name="05" value="3" style="width: 42px; height: 18px" id="ValidRadio_3"/>
                                <input type="radio" name="05" value="4" style="width: 42px; height: 18px" id="ValidRadio_4"/>
                                <input type="radio" name="05" value="5" style="width: 37px; height: 18px"id="ValidRadio_5"/>
                                </span>
                            </li>
                            <li>
                                <label for="name" style="width: 396px;font-weight:normal">Quality of communication from management <small>(how informed do you feel?)</small></label>
                                <span id="ValidRadio6" class="InputGroup">
                                <input type="radio" name="06" value="1" style="width: 37px; height: 18px" id="ValidRadio_1"/>
                                <input type="radio" name="06" value="2" style="width: 41px; height: 18px" id="ValidRadio_2"/>
                                <input type="radio" name="06" value="3" style="width: 42px; height: 18px" id="ValidRadio_3"/>
                                <input type="radio" name="06" value="4" style="width: 42px; height: 18px" id="ValidRadio_4"/>
                                <input type="radio" name="06" value="5" style="width: 37px; height: 18px"id="ValidRadio_5"/>
                                </span>
                            </li>
                            <li>
                                <label for="name" style="width: 396px;font-weight:normal">Benefits package</label>
                                <span id="ValidRadio7" class="InputGroup">
                                <input type="radio" name="07" value="1" style="width: 37px; height: 18px" id="ValidRadio_1"/>
                                <input type="radio" name="07" value="2" style="width: 41px; height: 18px" id="ValidRadio_2"/>
                                <input type="radio" name="07" value="3" style="width: 42px; height: 18px" id="ValidRadio_3"/>
                                <input type="radio" name="07" value="4" style="width: 42px; height: 18px" id="ValidRadio_4"/>
                                <input type="radio" name="07" value="5" style="width: 37px; height: 18px"id="ValidRadio_5"/>
                                </span>
                            </li>
                            <li>
                                <label for="name" style="width: 396px;font-weight:normal">Overall satisfaction</label>
                                <span id="ValidRadio8" class="InputGroup">
                                <input type="radio" name="08" value="1" style="width: 37px; height: 18px" id="ValidRadio_1"/>
                                <input type="radio" name="08" value="2" style="width: 41px; height: 18px" id="ValidRadio_2"/>
                                <input type="radio" name="08" value="3" style="width: 42px; height: 18px" id="ValidRadio_3"/>
                                <input type="radio" name="08" value="4" style="width: 42px; height: 18px" id="ValidRadio_4"/>
                                <input type="radio" name="08" value="5" style="width: 37px; height: 18px"id="ValidRadio_5"/>
                                </span>
                            </li>
                        </ul>
                        
                        <br/>
                        
                        <p><strong>Yes/No:</strong></p>
                        <ul>
                        <li>
                            <label for="name" style="width: 396px;font-weight:normal">Was the job what you expected?</label>
                            <span id="ValidRadio9" class="InputGroup">
                            Yes<input type="radio" name="09" value="Yes" style="width: 37px; height: 18px" id="ValidRadio_1"/>
                            No<input type="radio" name="09"  value="No" style="width: 41px; height: 18px" id="ValidRadio_2"/>
                            </span>
                        </li>
                        <li>
                            <label for="name" style="width: 396px;font-weight:normal">Is good performance recognised?</label>
                            <span id="ValidRadio10" class="InputGroup">
                            Yes<input type="radio" name="10" value="Yes" style="width: 37px; height: 18px" id="ValidRadio_1"/>
                            No<input type="radio" name="10"  value="No" style="width: 41px; height: 18px" id="ValidRadio_2"/>
                            </span>
                        </li>
                        <li>
                            <label for="name" style="width: 396px;font-weight:normal">Would you recommend 'company' to a friend?</label>
                            <span id="ValidRadio11" class="InputGroup">
                            Yes<input type="radio" name="11" value="Yes" style="width: 37px; height: 18px" id="ValidRadio_1"/>
                            No<input type="radio" name="11"  value="No" style="width: 41px; height: 18px" id="ValidRadio_2"/>
                            </span>
                        </li>
                        <li>
                            <label for="name" style="width: 396px;font-weight:normal">Did (or do) you feel loyal to the company?</label>
                            <span id="ValidRadio12" class="InputGroup">
                            Yes<input type="radio" name="12" value="Yes" style="width: 37px; height: 18px" id="ValidRadio_1"/>
                            No<input type="radio" name="12"  value="No" style="width: 41px; height: 18px" id="ValidRadio_2"/>
                            </span>
                        </li>
                        <li>
                                <label for="pcode"></label>
                                <input type="submit" name="btn-submit" value="" class="button-next" style="width: 113px; height: 27px;border:0"/>
                            </li>

                        </ul>
                    </fieldset>
                    </form>
    I dont understand why it does not work..

  2. #2
    Theoretical Physics Student bronze trophy Jake Arkinstall's Avatar
    Join Date
    May 2006
    Location
    Lancaster University, UK
    Posts
    7,062
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Comment out the call to header, for debugging purposes - if an error occurs, you won't see it if you're redirecting afterwards.

    echo $Insert. Does that query work inside PHPMyAdmin?

    Var_dump($add_member). Does that output 'false'? If so, then echo mysql_error(), which will tell you what went wrong.

    Off Topic:

    After a relocation call to header you should put
    PHP Code:
    exit; 
    afterwards to stop the rest of the content being sent to the page - saves processing, sometimes loading time.
    Jake Arkinstall
    "Sometimes you don't need to reinvent the wheel;
    Sometimes its enough to make that wheel more rounded"-Molona

  3. #3
    SitePoint Wizard billy_111's Avatar
    Join Date
    Jul 2009
    Posts
    1,683
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hey,

    I did a Var_dump and echoed out mysql_error and got this error:-

    bool(false) Column count doesn't match value count at row 1
    I have no idea what this means, this is my code:-

    PHP Code:
                        include("../conn.php");    
                                        
                        
    $insert "INSERT INTO tbl_rate_company(job_review_id, member_id, job_security, training, career_program, quality, quality_management, benefits, overall, expected, performance, recommend, loyal, date_added)
                        VALUES 
                        (
                        "
    .$_SESSION['review_id'].", 
                        "
    .$_SESSION['MEM_ID'].", 
                        '"
    .$_POST['01']."', 
                        '"
    .$_POST['02']."', 
                        '"
    .$_POST['03']."', 
                        '"
    .$_POST['04']."', 
                        '"
    .$_POST['05']."', 
                        '"
    .$_POST['06']."', 
                        '"
    .$_POST['07']."', 
                        '"
    .$_POST['08']."', 
                        '"
    .$_POST['09']."', 
                        '"
    .$_POST['10']."', 
                        now()
                        )"
    ;
                        
    $add_member mysql_query($insert) or mysql_error();
                        
                        echo 
    Var_dump($add_member);    
                        echo 
    mysql_error();                                
                                
                    } 
    I will be using mysql_real_escape_string im just testing this out first..

    Regards

  4. #4
    SitePoint Wizard billy_111's Avatar
    Join Date
    Jul 2009
    Posts
    1,683
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    AHH! I've got it, it makes sense now.

    What i was doing was trying to insert more fields that the columns in the database..

    Phew..

    Regards

  5. #5
    Theoretical Physics Student bronze trophy Jake Arkinstall's Avatar
    Join Date
    May 2006
    Location
    Lancaster University, UK
    Posts
    7,062
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Happens to the best of us

    By the way, if I were you I would reconsider the names of some of those fields. Sure, it'll work but debugging would get quite annoying if you keep having to check what, for example, $_POST['5'] holds - when if it was $_POST['ManagementQuality'], you'd know exactly what it is simply by looking at its name.
    Jake Arkinstall
    "Sometimes you don't need to reinvent the wheel;
    Sometimes its enough to make that wheel more rounded"-Molona

  6. #6
    SitePoint Wizard billy_111's Avatar
    Join Date
    Jul 2009
    Posts
    1,683
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    True,

    i will go with your advice, im still an amateur!

    Regards


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •