Jump to content

Archived

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

xyn

Little help needed :]

Recommended Posts

Hii,
I have a script which is for support tickets, The problem is
I wanted 3 options before the person begins the ticket. now
I wanted it so they use the "ratio" buttons to choose there
department.

How ever when I submit the choice, it doesn't do anything. :/.
Any ideas:

[code=php:0]<?PHP
$x = $_GET['ticket'];
if(!isset( $_POST['submit'] )) {
echo '<form method="post" action="add_ticket.php">
  <table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="250">
    <tr>
      <td width="14"><input type="radio" value="1" name="option"></td>
      <td width="236"><b>Website</b><br>
      Info about website.<br>
&nbsp;</td>
    </tr>
    <tr>
      <td width="14"><input type="radio" value="2" name="option"></td>
      <td width="236"><b>Testing</b><br>
      Testing purposes.<br>
&nbsp;</td>
    </tr>
    <tr>
      <td width="14"><input type="radio" value="3" name="option"></td>
      <td width="236"><b>Other</b><br>
      Other queries not listed above.<br>
&nbsp;</td>
    </tr>
  </table>
  <input type="submit" value="Post Ticket" style="width: 80; height: 22">
</form>';

}else{

if( $_POST['option'] == "1" ) {
echo 'option 1';

}elseif( $_POST['option'] == "2" ) {
echo 'option 2';

}elseif( $_POST['option'] == "3" ) {

}else{
echo 'Error: Option unavailable...';
}

if( $x = submit ) {
echo 'submit_ticket';

}else{
echo 'Error: Ticket function does not exist.';
}
}
?>[/code]

Share this post


Link to post
Share on other sites
Try this:
[code]<?php

$x = isset($_GET['ticket']) ? $_GET['ticket'] : '';

if(!isset($_POST['submit']))
{
    echo <<<HTML
<form method="post" action="test.php?ticket={$x}">
  <table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="250">
    <tr>
      <td width="14"><input type="radio" value="1" name="option"></td>
      <td width="236">
        <b>Website</b><br>
        Info about website.
      </td>
    </tr>
    <tr>
      <td width="14"><input type="radio" value="2" name="option"></td>
      <td width="236">
        <b>Testing</b><br>
        Testing purposes.<br>
      </td>
    </tr>
    <tr>
      <td width="14"><input type="radio" value="3" name="option"></td>
      <td width="236">
        <b>Other</b><br>
        Other queries not listed above.<br>
      </td>
    </tr>
  </table>
  <input type="submit" value="Post Ticket" name="submit" style="width: 80; height: 22">
</form>
HTML;
}
else
{
    if($x == 'submit')
    {
        echo 'submit_ticket<br /><br />';

        switch($_POST['option'])
        {
            case 1:
                echo 'Option 1';
            break;

            case 2:
                echo 'Option 1';
            break;

            case 3:
                echo 'Option 3';
            break;

            default:
                echo 'Error: Option unavailable...';
            break;
        }
    }
    else
    {
        echo 'Error: Ticket function does not exist.';
    }
}

?>[/code]

Share this post


Link to post
Share on other sites

×

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.