Jump to content

[SOLVED] PHP/HTML Form Submission


RealDrift

Recommended Posts

poco, thanks a lot for ur help so far

 

its 3:06am here in the UK,London, i am gonna head to bed

 

please post any more suggestions, i will try them and inform you tommorow

 

i having been banging my head on the wall trying to make the form work, something so simple yet so painful. I really appreciate your help

Link to comment
Share on other sites

Okay, this HAS to work. I tested it, so I think it will.

 

<?php session_start(); ?>

<html>
<link rel="stylesheet" href="includes/in.css" type="text/css">
<style type="text/css">
<!--
.style5 {
    font-family: Verdana, Arial, Helvetica, sans-serif;
    font-size: 11px;
    font-weight: bold;
}
.style10 {
    font-family: Verdana, Arial, Helvetica, sans-serif;
    font-size: 10px;
    font-weight: bold;
}
.style11 {
font-size: 10px}
.style12 {
    font-family: Verdana, Arial, Helvetica, sans-serif;
    font-size: 10px;
}
-->
</style>

<?php

include_once "includes/db_connect.php";
include_once"includes/functions.php";
logincheck();
$username=$_SESSION['username'];


if ($_POST['open']) {

   $spt = strip_tags(trim($_POST['spt']));
   $title = strip_tags(trim($_POST['title_insert']));
   $cat = strip_tags($_POST['category']);

    if (empty($spt) && empty($title)) {
        echo "Fill in all fields.";
        
    } else {
    
        $query = "INSERT INTO `support` ( `writer`,`reply`,`read`,`ticket`,`time`,`title`,`category`) 
        VALUES ('$username','0','0','$spt',NOW(),'$title','$cat')";
        $result = mysql_query($query)or die($query.'<br>'.mysql_error());
        
        echo '<p>'.$query.'<p>';
        
    }
}


?>

<center>

<table width="100%" border="0" cellspacing="2" cellpadding="0">
<tr>
<td width="39%"> 
</td>
<td width="52%"> 
</td>
<td width="9%"> 
</td>
</tr>
<tr>
<td><table width=100% align="center" cellpadding=2 cellspacing=0 rules=none class=thinline>
<tr>
<td height="17" align=center background=includes/grad.jpg><span class="style10"><font color=#FFFFFF>Ticket Information</font></span></td>
</tr>
<tr>
<td><span class="style12"> Submit a Ticket to an Admin or a Mod, Bugs will be fixed as soon as we read the message and if it is very serious we will reward you. Money Bugs Only Not Typing Errors! </span>
<p class="style12"> <font color=#CC0000>Warning</font>: Tickets may take up to 24 hours to be answered so please be patient.          </td>
</tr>
</table>
<br>
<table width=100% height="38" border=1 align="center" cellpadding=2 cellspacing=0 bordercolor=black class=thinline>
<tr>
<td height="19" colspan=2 align=center background=includes/grad.jpg><span class="style5 style11 style12"><font color=#FFFFFF>Open tickets</font></span></td>
</tr>
<td align=center bgcolor="#494949" class=style12 style8> Name</td>
<td align=center bgcolor="#494949" class=style12 style8> Tickets Closed </td>
</tr>
<tr>

<?php

/// add ticket ppl here
$users_sup = array("1" => "WentWorth",
"2" => "Mobsterkenny",
"3" => "Trivium",


);
$i = 1;
while ($i < 4) {
    $upstats = mysql_query("SELECT amount FROM ticketinfo WHERE username='$users_sup[$i]'");
    while ($getandpost = mysql_fetch_row($upstats)) {
        $total = $getandpost[0];
    }
    
    echo "<tr><td><a href='profile.php?viewuser=$users_sup[$i]'>$users_sup[$i]</a></td> <td>$total</td></tr>";
    
    $i++;
}

?>
</table></td>
<td><table width=90% border=1 align=center cellpadding=1 cellspacing=1 bordercolor=black class="thinline">
<tr class=title>
<td height="15" colspan="2" background=includes/grad.jpg><div align="center"><strong>Create Help Ticket </strong></div></td>
</tr>
<tr class=title>
<td width="49%" height="15"><div align="center"><span class="style10">Topic Title</span></div></td>
<td width="51%">
<form name="form1" method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>">
<div align="center">
<input name="title_insert" type="text" class="submit"  style=width: size="60%";
>
</div></td>
</tr>
<tr class=title>
<td height="29"><div align="center"><strong>Category</strong></div></td>
<td height="29">
<label> </label>
<div align="center">

<select name="category">
<option value="Bug/Exploits Report" selected>Bug/Exploits Report</option>
<option value="Duplicate Accounts Report">Duplicate Accounts Report</option>
<option value="Scam Report">Scam Report</option>
<option value="Scripter/Exploiter Report">Scripter/Exploiter Report</option>
<option value="Credits Question">Credits Question</option>
<option value="Other Question">Other Question</option>
</select>
</div>
</td>
</tr>
<tr class=text>
<td height="15" colspan="2" bgcolor="#494949"><div align="center"><span class="style10">Message</span></div></td>
</tr>
<tr class=sub>
<td height="185" colspan="2"><div align="center">
<textarea name="spt" style="width: 98%; height: 175px"  class="submit"></textarea>
</div></td>
</tr>
<tr  class=title>
<td colspan="2"><div align="center">
<input name="open" type="submit" class="submit" style="background-color: #990000;
bottom;
background-repeat: repeat;
border: 1;
color: #FFFFFF;
cursor: pointer;
height: 20px;
border-left: 1px solid #000000;
border-right: 1px solid #000000;
border-top: 1px solid #000000;
border-bottom: 1px solid #000000;
font-size: 7.5pt;
font-weight: normal;
font-colour:#FFFFFF;
font-family: Verdana" value="Open Help Ticket">
<label></label>
</div></td>
</tr>
</table></td>
<td> 
</td>
</tr>
<tr>
<td> 
</td>
<td> 
</td>
<td> 
</td>
</tr>
</table>
<br>
</tr>
</td>
</tr>
</table>
<br>
</form>
<br>

Link to comment
Share on other sites

yes poco that works!!!!!!!!

 

thanks so much man i know how frustrating this script was, thanks thanks thanks

 

for my learning experience i will compare the original script and the one you edited. But can you tell me generally why this simple script didn't work in the first place? this script has made me lose my confidence in coding in php.

Link to comment
Share on other sites

You didn't do anything major wrong, so don't lose confidence over this. It was actually mainly your HTML, not your PHP. You closed your form twice for some reason, and the first one you closed before putting your submit button, so that input was cut off from the form. Then you had your opening <form> AFTER your title input, and that cut that off, so I had to move the <form> above it.

 

Then you just had a few minor PHP mistakes. Just look back at what I changed and you will understand more :)

 

Don't forget to press "solved" so no one comes into this thread thinking you still need help.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.