Jump to content

Form Action Problems


Xtremer360

Recommended Posts

After I submit the form it doesn't place it in the database. Don't know why.

 

print '<h1 class="backstage">Match Type Management</h1><br />';
    print '<h2 class="backstage">Add New Match Type</h2><br />';
    print '<form name="matchtype" method="post">';
    print '<table width="100%" class="table2">';
    print '<tr>';
    print '<td width="120" class="rowheading" valign="center">Match Type:</td><td class="row3"><input type="text" name="matchtype" class="fieldtext490"></td>';
    print '</tr>';
    print '</table><br />';
    print '<input type="hidden" name="newadded"><input type="submit" value="Save Match Type" class="button" name="addmatchtype"></form><br />';
    print '<form method="POST"><input type="submit" value="Return to Match Type List" class="button200" name="return"></form><br />';

 

<?php 
    function matchtypes()
    {
        if(isset($_POST['addmatchtype']))
    {
        $matchtype = $_POST['matchtype'];
        $query = "INSERT INTO `efed_list_matchtypes` (`matchtype`) VALUES ('$matchtype')";

        if (@mysql_query ($query)) 
        {
            print '<p>The match type has been added.</p>';
        } else 
        
            {
                print '<p>Could not add the entry because: <b>" . mysql_error() . "</b>. The query was $query.</p>';
            }
  
    }
    }
?> 

Link to comment
Share on other sites

u should include a file right at the top of the php file

u can use it under the

<?php 

tag

like this

<?php
include "inc.php";
print '<h1 class="backstage">Match Type Management</h1><br />';
    print '<h2 class="backstage">Add New Match Type</h2><br />';
    print '<form name="matchtype" method="post">';
    print '<table width="100%" class="table2">';
    print '<tr>';
    print '<td width="120" class="rowheading" valign="center">Match Type:</td><td class="row3"><input type="text" name="matchtype" class="fieldtext490"></td>';
    print '</tr>';
    print '</table><br />';
    print '<input type="hidden" name="newadded"><input type="submit" value="Save Match Type" class="button" name="addmatchtype"></form><br />';
    print '<form method="POST"><input type="submit" value="Return to Match Type List" class="button200" name="return"></form><br />';

    function matchtypes()
    {
        if(isset($_POST['addmatchtype']))
    {
        $matchtype = $_POST['matchtype'];
        $query = "INSERT INTO `efed_list_matchtypes` (`matchtype`) VALUES ('$matchtype')";

        if (@mysql_query ($query)) 
        {
            print '<p>The match type has been added.</p>';
        } else 
        
            {
                print '<p>Could not add the entry because: <b>" . mysql_error() . "</b>. The query was $query.</p>';
            }
  
    }
    }
?> 

 

i dont know y it didnt showed u any error..

it should have obviusly given u one..

just try this code and see..

also one more thing change the file name from inc.php to something relevant

 

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.