RevCMS Report Tool

Detox

Member
Jul 24, 2010
365
24
Hello Dev,
I have attempted to create a report tool and kinda works like I wanted but not fully working!
So when I go to report page, it will not throw off error that I'm requesting it to do. It will insert blank stuff into the database. But I need it to where you must fill out the forum and to agree to the terms.

PHP:
<?php 

if(isset($_POST['report_submit']))
                {
                    $report_id = mysql_real_escape_string($_POST['report_id']);
                    $report_type = mysql_real_escape_string($_POST['report_type']);
                    $report_info = mysql_real_escape_string($_POST['report_info']);
                    $report_more = mysql_real_escape_string($_POST['report_more']);
                    $report_staff = mysql_real_escape_string($_POST['report_staff']);

                        if((($report_type == "Complaint against a member of staff") ||($report_type == "Request a furni to be added or fixed") || ($report_type == "Comment/Suggestion") || !empty($_POST['report_agree'])))
                        {
                            mysql_query("INSERT INTO `staff_report` (id,complaint,staff,explanation, moreinfo) VALUES ('".$report_id."','".$report_type."', '".$report_staff."' ,'".$report_info."', '".$report_more."')");
                            echo '
                            <div id="container">
                            <div id="content" style="position: relative" class="clearfix">
                            <div class="alert alert-info" style="margin-bottom: 10px;width:570px;height:3%;">
                            <strong><center>We have successfully received your report!</strong></center></div></div></div>';
                        }   
                        else
                        {
                            echo '
                            <div class="rounded rounded-red">

                            Please Complete the forum!

                            </div>';
                        }                       
                }
               ?>         
              
<form method="post" class="form" name ="report_submit">
<div class="form-group">
<label for="disabledTextInput"><b>Please choose one of the following</b></label>
<div class="col-sm-10">
<select name="report_type" class="form-control">
                                        <option value="Complaint against a member of staff">Complaint against a member of staff</option>
                                        <option value="Request a furni to be added or fixed">Request a furni to be added or fixed</option>
                                        <option value="Comment/Suggestion">Comment/Suggestion</option>
                                </select>
                            </div>
                            </div>
                            <br/>
<div class="form-group">
<label for="disabledTextInput"><b>Please choose a member of staff (If you are reporting/complimenting a staff member)</b></label>
<div class="col-sm-10">
<div class="col-sm-10">
<select name="report_staff" class="form-control">
<option value="N/A">N/A</option>
    <option disabled>-------------------------</option>
<?php
$getStaff = mysql_query("SELECT username FROM users WHERE rank >= '3'");
 while($staffUser = mysql_fetch_array($getStaff)){
    echo'
    <option value="'. $staffUser['username'] .'">'.$staffUser['username'].'</option>';
}
?>
</select>
</div>
</div>
</div>
<br/>
<div class="form-group">
<label for="exampleInputEmail1"><b>Please explain what you are reporting/suggesting or what is wrong with the furni you are asking to be fixed</b></label>
<div class="col-sm-10">
<textarea class="form-control" rows="5" name="report_info" maxlength="255" style="width:350px;height:75px;resize:none"></textarea>
</div>
</div>
<br/>
<div class="form-group">
<label for="exampleInputEmail1"><b>Would you like to add anything?</b><br><i>Proof? Pictures of the furni, anything else you think is important?! Leave it here!</i></label>
<div class="col-sm-10">
<textarea class="form-control" rows="3" name="report_more" maxlength="255" class="ss-q-short" style="width:350px;height:75px;resize:none"></textarea>
</div>
</div>
<br/>                           
<div class="checkbox">
<label><input name="report_agree" value="0" type="checkbox">I am aware that if my report is spam, my account could be banned.</label>
</div>
<br>
<input type="submit" value="Submit" name="report_submit" class="submit" style="float left">
</form>
 

JayC

Always Learning
Aug 8, 2013
5,493
1,398
I don't really understand what your problem is, could you clarify? Is it inserting blank data?

Also, your report type is very badly coded. It should be an int value that converts to a type. For instance, you insert "1" for a staff issue, and "2" for another issue. You could even make another table called "reporting_types" and have an Id and a value field, and have the Id be the foreign key for your reports table. And then select all of the report types for your form, and echo them out, then verify that ID exists in your form validation
 

Detox

Member
Jul 24, 2010
365
24
I don't really understand what your problem is, could you clarify? Is it inserting blank data?

Also, your report type is very badly coded. It should be an int value that converts to a type. For instance, you insert "1" for a staff issue, and "2" for another issue. You could even make another table called "reporting_types" and have an Id and a value field, and have the Id be the foreign key for your reports table. And then select all of the report types for your form, and echo them out, then verify that ID exists in your form validation

2yumzx4.jpg
 

Users who are viewing this thread

Top