Jump to content

display and edit data all at once


kemper

Recommended Posts

I am hosting a sports website and am processing schedules for the particpating clubs to assign times and field assignments.

[color=blue]Basically, I want a form to appear (if "Club 2" scheduler was logged in) similar to:[/color]
[img]http://www.daswebhaus.com/images/tableform.jpg[/img]

I am not sure where to start expect with database login information.

Assistance is greatly appreciated.
Link to comment
https://forums.phpfreaks.com/topic/34841-display-and-edit-data-all-at-once/
Share on other sites

You would simply do.

If (isset($_POST['submit']))
{
  // Update the database and do whatever else you want....
}

Then Do what you are currently doing. Select the info from the database and display the form. The form should be pointed to itself so that the one page does the update and the display.

<FORM name='whatever' action='' method='post'>

- Dave
I know how to display the data, but not to have the fill in fields for the two cells that my schedules will edit.  I created that screenshot manually.  [color=blue]How do I write the script to include edittable text fields under "Time" and "Field"?[/color]  I was onlce told to add:
[code]echo '<a href="editpage.php?id='.$row[id].'">EDIT</a>';
echo '<a href="deletepage.php?id='.$row[id].'">DELETE</a>'
[/code]

But I do not want each line editted individually.  This would take forever for my schedulers to edit their schedules.  I have 1500 games to be editted, and some clubs have to edit for >150 games each.

Any suggestions?

Thanks.
This is what I have to display the requested information:
[code]<?php
require_once "maincore.php";
require_once "subheader.php";
require_once "side_left.php";

if (isset($readmore) && !isNum($readmore)) fallback(FUSION_SELF);
opentable("Team Contacts");
    // mySQL Table
    $db_con = mysql_connect(MyHost, MyUsername, MyPassword) or die("Connetion to database failed!");
    mysql_select_db(MyDatabase);
$age = $_GET['club'];
$sql = "SELECT club, age, date, time_notes, time, cemail, home, visitors, field FROM MyTable WHERE club='$club'";
$result = mysql_query($sql) or die(mysql_error());
$i = 0;

    echo "<font face='Arial' size='4' color='#000000'><b>Team contacts for all divisions of $age:</b></font><p style='margin-top: 0'>
<font face='Arial' size='3'>To update your team's contact listing, <u>
<font color='#0000ff'><a href='http://www.myrsl.org/viewpage.php?page_id=43'>
<font color='#0000cc'>click here<br></font></a></font></u></font><br><br>\n\n";

echo "</p>
<table width='100%' border='1' cellspacing='0' cellpadding='5' bordercolorlight='#000000' bordercolordark='#000000'><tr>
        <th align='left' bgcolor='#FF0000' style='border-style: solid; border-width: 1px' bordercolor='#000000' bordercolorlight='#ff0000' bordercolordark='#000000'>
<font face='Arial' color='#FFFFFF' size='2'>Club</font></th>
        <th align='left' bgcolor='#FF0000' style='border-style: solid; border-width: 1px' bordercolor='#000000' bordercolorlight='#ff0000' bordercolordark='#000000'>
<font face='Arial' color='#FFFFFF' size='2'>Age</font></th>
        <th align='left' bgcolor='#FF0000' style='border-style: solid; border-width: 1px' bordercolor='#000000' bordercolorlight='#ff0000' bordercolordark='#000000'>
<font face='Arial' color='#FFFFFF' size='2'>Date</font></th>
        <th align='left' bgcolor='#FF0000' style='border-style: solid; border-width: 1px' bordercolor='#000000' bordercolorlight='#ff0000' bordercolordark='#000000'>
<font face='Arial' color='#FFFFFF' size='2'>Time/Notes</font></th>
        <th align='left' bgcolor='#FF0000' style='border-style: solid; border-width: 1px' bordercolor='#000000' bordercolorlight='#ff0000' bordercolordark='#000000'>
<font face='Arial' color='#FFFFFF' size='2'>Time</font></th>
        <th align='left' bgcolor='#FF0000' style='border-style: solid; border-width: 1px' bordercolor='#000000' bordercolorlight='#ff0000' bordercolordark='#000000'>
<font face='Arial' color='#FFFFFF' size='2'>Home Team</font></th>
        <th align='left' bgcolor='#FF0000' style='border-style: solid; border-width: 1px' bordercolor='#000000' bordercolorlight='#ff0000' bordercolordark='#000000'>
<font face='Arial' color='#FFFFFF' size='2'>Visiting Team</font></th>
        <th align='left' bgcolor='#FF0000' style='border-style: solid; border-width: 1px' bordercolor='#000000' bordercolorlight='#ff0000' bordercolordark='#000000'>
<font face='Arial' color='#FFFFFF' size='2'>Field</font></th>
        </tr>';
       
    while ($row = mysql_fetch_array($result)) {
    echo '<tr>
    <td valign='top' style='border-style: solid; border-width: 1px' bordercolor='#ff0000' bordercolorlight='#ff0000' bordercolordark='#000000'>
    <font face='Arial' size='1'>' . $row['club'] . &quot;</font></td>
    <td valign='top' style='border-style: solid; border-width: 1px' bordercolor='#ff0000' bordercolorlight='#ff0000' bordercolordark='#000000'>
    <p style='margin-top: 0; margin-bottom: 0'><font face='Arial' size='1'>' . $row['age'] . '</font><p style='margin-top: 0; margin-bottom: 0'>
    <font face='Arial' size='1'>&nbsp;</font><p style='margin-top: 0; margin-bottom: 0'>
    <font face='Arial' size='1'>&nbsp;</font></td>
    <td valign='top' style='border-style: solid; border-width: 1px' bordercolor='#ff0000' bordercolorlight='#ff0000' bordercolordark='#000000'>
    <p style='margin-top: 0; margin-bottom: 0'><font face='Arial' size='1'>' . $row['date'] . '</font></td>
    <td valign='top' style='border-style: solid; border-width: 1px' bordercolor='#ff0000' bordercolorlight='#ff0000' bordercolordark='#000000'>
    <p style='margin-top: 0; margin-bottom: 0'><font face='Arial' size='1'>' . $row['time_notes'] . '</font></td>
    <td valign='top' style='border-style: solid; border-width: 1px' bordercolor='#ff0000' bordercolorlight='#ff0000' bordercolordark='#000000'>
    <p style='margin-top: 0; margin-bottom: 0'><font face='Arial' size='1'>' . $row['time'] . '</font></td>
    <td valign='top' style='border-style: solid; border-width: 1px' bordercolor='#ff0000' bordercolorlight='#ff0000' bordercolordark='#000000'>
    <p style='margin-top: 0; margin-bottom: 0'><font face='Arial' size='1'>&quot; . $row['home']
. &quot;</font></td>
    <td valign='top' style='border-style: solid; border-width: 1px' bordercolor='#ff0000' bordercolorlight='#ff0000' bordercolordark='#000000'>
    <p style='margin-top: 0; margin-bottom: 0'><font face='Arial' size='1'>' . $row['visitors'] . '</font></p>
    </td>
    <td valign='top' style='border-style: solid; border-width: 1px' bordercolor='#ff0000' bordercolorlight='#ff0000' bordercolordark='#000000'>
    <p style='margin-top: 0; margin-bottom: 0'><font face='Arial' size='1'>' . $row['field'] . '</font></p>
    </td>
    </tr>';
    }
echo '</table>\n";

  // mySQL ends
closetable();
require_once "side_right.php";
require_once "footer.php";
?>[/code]

[color=blue]In my scheduling process, all data is included in the MySQL table with exception of "Time" ($row['time']) and "Field" ($row['field']).  That information is determined by Club Field Schedulers.  Those two columns in my table are where I can Text Fields for input.[/color]

Any suggestions would be great!

Archived

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

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