1)Adding Duplicate Form and 2)Deleting Current Form

This is where you share YOUR scripts with others

Moderators: macek, egami, gesf

phantasmAmber
New php-forum User
New php-forum User
Posts: 3
Joined: Fri Sep 16, 2011 6:45 pm

1)Adding Duplicate Form and 2)Deleting Current Form

Postby phantasmAmber » Fri Sep 16, 2011 7:11 pm

There are two things I am trying to accomplish here (at least to start the process). As seen in the Subject line. My goal is to allow members to submit games by filling in a form. The first objective is once the form is filled in, they can hit a button called let is say "Add Match" and another form is generated below (eventually I will like to get it to copy the values from the previous form, but not at this time). The second query, which might be the easier one, is to delete a form.

The original function I had one page asking users to chose the number of games to submit. In this final version I will be removing this primary page and replacing it with the "Add Match" feature. But for now one must generate a page or 2.

**Also please note there are other functions that are still missing or still being worked on (obviously you will see this when playing around)**

http://www.tiny9.com/u/SubmitGame <---select one or two and hit Submit.

CODE OF THE GENERATED PAGE
===========================================
<?php
session_start(); // start up PHP session!
if(isset($_SESSION['views']))
$_SESSION['views'] = $_SESSION['views']+ 1; // store session data
else
$_SESSION['views'] = 1;
echo "Pageviews = ". $_SESSION['views']; //retrieve data
//if(isset($_SESSION['views']))
// unset($_SESSION['views']);
// session_destroy();
?>
<BR>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Game Scoring</title>
<!--REMOVED STYLE SHEET LINKS -->
</head>
<body>
<Span ID="PageHeading">Report Tournament Win/Lose</Span><br><br>
Enter the first match, then click &quot;Add Match&quot; to repeat process. Make any modifications that differ from the first entry.
<hr size='1'><BR>
<script type="text/javascript">
var url_part = 'dbjedi';
</script>
<script>
function swding(iets){
document.getElementById('indb').style.display="none"
document.getElementById('notindb').style.display="none"
iets.style.display=""
}
function swding2(iets){
document.getElementById('1v1').style.display="none"
document.getElementById('team').style.display="none"
iets.style.display=""
}
</script>
<script type="text/javascript">
<!--
function Reveal (it, box) {
var vis = (box.checked) ? "block" : "none";
document.getElementById(it).style.display = vis;
}

function Hide (it, box) {
var vis = (box.checked) ? "none" : "none";
document.getElementById(it).style.display = vis;
}

//-->
</script>
<?php
$quantity = $_POST['quantity'];
echo "<h3>You selected ". $quantity . " games.</h3><br />";
for ($i=1; $i<=$quantity; $i++)
{
echo "Match Number " . $i . "<BR />";
?>
<form method="post" action="pancake.php">
<table width="350" border="1" align="center" cellpadding="10" cellspacing="0">
<tr>
<td width="365"><div align="right">
<input name="match[<?php echo $i; ?>]" type="reset" id="match" value="Remove this Match"> <!--still needs php added/finished -->
</div>
<hr width="100%">
<table width="362" border="0">
<tr align="left">
<td width="50%">Score Type: </td>
<td width="50%">
<select name="match[<?php echo $i; ?>][CompetitionName]">
<option value="ERROR">Choose a Competition</option>
<option value="Gaming Nights">Gaming Nights</option>
<option value="Other Gaming 1">Other Gaming 1</option>
<option value="Other Gaming 2">Other Gaming 2</option>
<option value="Console Gaming 1">Console Gaming 1</option>
<option value="Console Gaming 2">Console Gaming 2</option>
<option value="Ladder Comp">Ladder Comp</option>
<option value="Training">Training</option>
<option value="Special Gaming 1">Special Gaming 1</option>
<option value="Special Gaming 2">Special Gaming 2</option>
<option value="Special Gaming 3">Special Gaming 3</option>
</select></td>
</tr>
<tr align="left">
<td>Platform:</td>
<td><select name="match[<?php echo $i; ?>][Platform]">
<option value="ERROR">Choose a Platform</option>
<option value="JK">JK</option>
<option value="JO">JO</option>
<option value="JA">JA</option>
<option value="XVT">XvT</option>
<option value="XWA">XWA</option>
<option value="BF">BF</option>
<option value="BF2">BF2</option>
<option value="RC">RC</option>
<option value="EAW">EaW</option>
<option value="Console">Console</option>
<option value="OtherPlatform">Other Platform</option>
</select></td>
</tr>
<tr align="left">
<td height="20" colspan="2"><small>If "Other Platform", please indicate what it was below.</small></td>
</tr>
<tr align="left">
<td>Other Platform::</td>
<td><input name="match[<?php echo $i; ?>][OtherPlatform]" type="text" value="n/a" size=20></td>
</tr>
<tr align="left">
<td height="40">Match Type:</td>
<td><input type="radio" name="match[<?php echo $i; ?>][MatchType]" value="1v1" Checked onClick="swding2(document.getElementById('1v1'))">1vs1 Match <br>
<input type="radio" name="match[<?php echo $i; ?>][MatchType]" value="team" onClick="swding2(document.getElementById('team'))">Team Match </td>
</tr>
</table>
<!-- THIS IS WHERE THE MATCH TYPES ARE REVEALED -->
<!-- 1v1 is REVEALED -->
<span id="1v1">
<hr width="100%">
<table width="100%" border=0>
<tr align="left">
<td width=40% valign=top>Your opponent:</td>
<td colspan="2">
<input type="radio" name="match[<?php echo $i; ?>][OpponentType]" value="in_db" Checked onClick="swding(document.getElementById('indb'))">Opponent is in the DJB <br>
<input type="radio" name="match[<?php echo $i; ?>][OpponentType]" value="not_in_db" onClick="swding(document.getElementById('notindb'))">Opponent is not in the DJB <br>
<HR width="100%">
<span id="indb">
PIN: <input type="text" name="match[<?php echo $i; ?>][Opponent_ID]" size="5" value=""><BR>
</span>
<span id="notindb" style="display:none;">
<table width="100%" border=0>
<tr>
<td>Name:</td>
<td><input type="text" size=25 name="match[<?php echo $i; ?>][OpponentName]" value=""></td>
<tr>
<td>E-mail:</td>
<td><input type="text" size=25 name="match[<?php echo $i; ?>][OpponentEmail]" value=""></td>
<tr>
<td>Club:</td>
<td><input type="text" size=25 name="match[<?php echo $i; ?>][OpponentClub]" value=""></td>
</table>
</span>
</td>
</tr>
<tr align="left">
<td>Did <b>you</b> Win or Lose? </td>
<td width="25%"><input type="radio" name="match[<?php echo $i; ?>][YouWin_Loss]" value="WinButton" checked onClick="Hide('boo', this); Reveal('yay', this)">Win
<input type="radio" name="match[<?php echo $i; ?>][YouWin_Loss]" value="LoseButton" onClick="Hide('yay', this); Reveal('boo', this)">Lose
<td width="25%"><div id="yay">Yay! :)</div><div id="boo"style="display:none">Booo :(</div></TD>
</tr>
</table>
</span>
<!--TEAM REVEALED-->
<span id="1v1"></span>
<span id="team" style="display:none;">
<hr width="100%">
<table border=0 width=100%>
<tr>
<td valign="top" width=50% align="left">Your team:</td>
<td width=50% align="left">
PIN: <input type="text" disabled value="9196" size=5><br> <!--PUT LOGIN USER PIN FOR FIRST ENTRY>
<!-- I believe this is not my pin 9196, but not sure what it should be instead, as I don't have access :) -->
PIN: <input type="text" name="match[<?php echo $i; ?>][YourTeam2_PIN]" size="5" value=""><br>
PIN: <input type="text" name="match[<?php echo $i; ?>][YourTeam3_PIN]" size="5" value=""><br>
PIN: <input type="text" name="match[<?php echo $i; ?>][YourTeam4_PIN]" size="5" value=""><br>
PIN: <input type="text" name="match[<?php echo $i; ?>][YourTeam5_PIN]" size="5" value=""><br><br>
</td>
</tr>
<tr>
<td valign="top" width=50% align="left">Opposing team:</td>
<td width=50% align="left">
PIN: <input type="text" name="match[<?php echo $i; ?>][OppTeam1_PIN]" size="5" value=""><br>
PIN: <input type="text" name="match[<?php echo $i; ?>][OppTeam2_PIN]" size="5" value=""><br>
PIN: <input type="text" name="match[<?php echo $i; ?>][OppTeam3_PIN]" size="5" value=""><br>
PIN: <input type="text" name="match[<?php echo $i; ?>][OppTeam4_PIN]" size="5" value=""><br>
PIN: <input type="text" name="match[<?php echo $i; ?>][OppTeam5_PIN]" size="5" value=""><br><br>
</td>
</tr>
<tr align="left">
<td width="25%">Did your <b>team</b> Win or Lose? </td>
<td><input type="radio" name="match[<?php echo $i; ?>][TeamWin_Loss]" value="WinButton" checked onClick="Hide('teamboo', this); Reveal('teamyay', this)">Win
<input type="radio" name="match[<?php echo $i; ?>][TeamWin_Loss]" value="LoseButton" onClick="Hide('teamyay', this); Reveal('teamboo', this)">Lose
<td width="25%"><div id="teamyay">Yay Team! :)</div><div id="teamboo"style="display:none">Booo Team :(</div></TD>
</tr>
</table>
</span>
</tr></table>
<TABLE width="390" align="center">
<TR><TD>
<div align="right"><br>
<input name="match[<?php echo $i; ?>]" type="reset" id="match" value="Add a Match"><!--still needs php added/finished -->
</div>
</TD>
</TR>
</TABLE>
</form>
<?php } ?>
<table width="390" align="center">
<tr>
<td><div align="right">
<input type="hidden" name="COMMAND" value="EXECUTE">
<input type="submit" name="CHOICE" value="Submit All"><!--still needs php added/finished, Ask Matthew where this is usually sent too, he may just want to input this -->
</div></td>
</tr>
</table>
</body>
</html>

=============================================================
Any assistance would be extremely greatful and hopefully this might benefit others too.

phantasmAmber
New php-forum User
New php-forum User
Posts: 3
Joined: Fri Sep 16, 2011 6:45 pm

Re: 1)Adding Duplicate Form and 2)Deleting Current Form

Postby phantasmAmber » Mon Sep 19, 2011 8:52 am

If more explaining is needed, please let me know. I am really stuck on this. Thanks


Return to “Your Scripts”

Who is online

Users browsing this forum: No registered users and 1 guest

cron