Help with multi database entry from 1 form

Hi all,

I’ve donea search on here and found one thread about this, but all the info was moved to one database and thus not as helpful as I needed.

I’ve been making a match/challenge/report system for my gaming clan and got a good amount done. After talking over next tweaks for it, I thought add in a challenge section that will fill in information needed, updating matches,clans tables (which I’ve done ok) but will also add a post to our “match” forum in phpbb3.

I’ve got base code for the entry of the match details done and this is posted below. I’m looking for guidance on how i can go about this, as i’m not 100% sure.

[php]<?php
error_reporting(E_ALL);
include_once ‘connect2.php’;
$action = $_GET[‘action’];
if(isset($action) && $action == ‘addRecord’)
{
$submit = $_POST[‘submit’];
if(isset($submit))
{
// Add Match Record…
// Define post fields into simple variables
$home = $_POST[‘home’];
$away = $_POST[‘away’];
$day = $_POST[‘day’];
$month = $_POST[‘month’];
$year = $_POST[‘year’];
$time = $_POST[‘time’];
$ampm = $_POST[‘ampm’];
$matchtype = $_POST[‘matchtype’];

/* Let's strip some slashes in case the user entered
any escaped characters. */
$home = stripslashes($home);
$away = stripslashes($away);
   
// Enter info into the Database.
$sql = mysql_query("INSERT INTO ukematch VALUES ('', '$home', '$away', '$day', '$month', '$year', '$time', '$ampm', 'TBC', 'TBC', 'TBC', 'TBC', 'TBC', '$matchtype', 'TBC', 'TBC', 'TBC', 'TBC', 'TBC', 'TBC', 'TBC', 'TBC', 'TBC', 'TBC', 'TBC', 'TBC', 'TBC', 'TBC')") or die (mysql_error());
header("Location: addmatch.php");
error_reporting(E_ALL);

}
else
{
// Add Match Form…
$title = “Add a Match”;
include_once ‘header.php’;

?>

UKE Match Page

New Match

 

Home
Away
Date (Day)
Date (Month ie Jan,Feb)
Year
Time
Am / Pm Choose One AM PM  
Match Type Choose One Friendly 4v4 Friendly 8v8 Friendly 12v12 Friendly 16v16 Friendly Other Internal 4v4 Internal 8v8 Internal 12v12 Internal 16v16 Internal Other Scrim 4v4 Scrim 8v8 Scrim 12v12 Scrim 16v16 Scrim Other Ladder  
<?php
include_once 'footer.php';	

}
}
?>[/php]

Would I need to add in a 2nd include for the database, and doing so can I then use a 2nd sql update to post the info into the phpbb3 table for the right forum?

Found a way to do this. Maybe not the best way, but it’s working.

Split the things I wanted to do into other files.

so main file updates the form and inputs to the matches database.
new file called post updates 2 tables within phpbb3 with predefined details (datetime issue with this tho, shows as 1st jan 1970 lawl)
2nd new file email to send an email to the admins and match organiser.

Sponsor our Newsletter | Privacy Policy | Terms of Service