How do I make a global update button.

General discussions related to php

Moderators: macek, egami, gesf

ckwall

How do I make a global update button.

Postby ckwall » Thu Jan 16, 2003 10:35 am

I have a page with the following update fields. As a beginner, I have learned to make the update scripts, and such, but is there a way to make an update button to run all of the updates on one page?

Here is what I have so far. In responding, please be descriptive, I am not terribly comfortable with what I am doing yet.

<html>
<table width="50%" border="0">
<tr>
<td>mark</td>
<td>Available:</td>
<td>On Site:</td>
</tr>
<tr>
<td>Sunday:</td>
<td><FORM NAME="fa" ACTION="mark_av_sun.php" METHOD="POST">
<TEXTAREA NAME="mark_av_sun" ROWS=1 COLS=10></TEXTAREA>
<INPUT TYPE="submit" VALUE="Update">
</FORM></td>
<td><FORM NAME="fa" ACTION="mark_os_sun.php" METHOD="POST">
<TEXTAREA NAME="mark_os_sun" ROWS=1 COLS=10></TEXTAREA>
<INPUT TYPE="submit" VALUE="Update">
</FORM></td>
</tr>
<tr>
<td>Monday:</td>
<td><FORM NAME="fa" ACTION="mark_av_mon.php" METHOD="POST">
<TEXTAREA NAME="mark_av_mon" ROWS=1 COLS=10></TEXTAREA>
<INPUT TYPE="submit" VALUE="Update">
</FORM></td>
<td><FORM NAME="fa" ACTION="mark_os_mon.php" METHOD="POST">
<TEXTAREA NAME="mark_os_mon" ROWS=1 COLS=10></TEXTAREA>
<INPUT TYPE="submit" VALUE="Update">
</FORM></td>
</tr>
<tr>
<td>Tuesday:</td>
<td><FORM NAME="fa" ACTION="mark_av_tues.php" METHOD="POST">
<TEXTAREA NAME="mark_av_tues" ROWS=1 COLS=10></TEXTAREA>
<INPUT TYPE="submit" VALUE="Update">
</FORM></td>
<td><FORM NAME="fa" ACTION="mark_os_tues.php" METHOD="POST">
<TEXTAREA NAME="mark_os_tues" ROWS=1 COLS=10></TEXTAREA>
<INPUT TYPE="submit" VALUE="Update">
</FORM></td>
</tr>
<tr>
<td>Wednesday:</td>
<td><FORM NAME="fa" ACTION="mark_av_wed.php" METHOD="POST">
<TEXTAREA NAME="mark_av_wed" ROWS=1 COLS=10></TEXTAREA>
<INPUT TYPE="submit" VALUE="Update">
</FORM></td>
<td><FORM NAME="fa" ACTION="mark_os_wed.php" METHOD="POST">
<TEXTAREA NAME="mark_os_wed" ROWS=1 COLS=10></TEXTAREA>
<INPUT TYPE="submit" VALUE="Update">
</FORM></td>
</tr>
<tr>
<td>Thursday:</td>
<td><FORM NAME="fa" ACTION="mark_av_thurs.php" METHOD="POST">
<TEXTAREA NAME="mark_av_thurs" ROWS=1 COLS=10></TEXTAREA>
<INPUT TYPE="submit" VALUE="Update">
</FORM></td>
<td><FORM NAME="fa" ACTION="mark_os_thurs.php" METHOD="POST">
<TEXTAREA NAME="mark_os_thurs" ROWS=1 COLS=10></TEXTAREA>
<INPUT TYPE="submit" VALUE="Update">
</FORM></td>
</tr>
<tr>
<td>Friday:</td>
<td><FORM NAME="fa" ACTION="mark_av_fri.php" METHOD="POST">
<TEXTAREA NAME="mark_av_fri" ROWS=1 COLS=10></TEXTAREA>
<INPUT TYPE="submit" VALUE="Update">
</FORM></td>
<td><FORM NAME="fa" ACTION="mark_os_fri.php" METHOD="POST">
<TEXTAREA NAME="mark_os_fri" ROWS=1 COLS=10></TEXTAREA>
<INPUT TYPE="submit" VALUE="Update">
</FORM></td>
</tr>
<tr>
<td>Saturday:</td>
<td><FORM NAME="fa" ACTION="mark_av_sat.php" METHOD="POST">
<TEXTAREA NAME="mark_av_sat" ROWS=1 COLS=10></TEXTAREA>
<INPUT TYPE="submit" VALUE="Update">
</FORM></td>
<td><FORM NAME="fa" ACTION="mark_os_sat.php" METHOD="POST">
<TEXTAREA NAME="mark_os_sat" ROWS=1 COLS=10></TEXTAREA>
<INPUT TYPE="submit" VALUE="Update">
</FORM></td>
</tr>
</table>
</html>

User avatar
WiZARD
Moderator
Moderator
Posts: 1257
Joined: Thu Jun 20, 2002 10:14 pm
Location: Ukraine, Crimea, Simferopol
Contact:

Re: How do I make a global update button.

Postby WiZARD » Fri Jan 17, 2003 12:26 am

How about this?

Code: Select all

<html>
<FORM NAME="fa" ACTION="proc.php" METHOD="POST">
<table width="50%" border="0">
  <tr>    <td>mark</td>    <td>Available:</td>    <td>On Site:</td>  </tr>  <tr>    <td>Sunday:</td>
    <td><TEXTAREA NAME="mark_av_sun" ROWS=1 COLS=10></TEXTAREA>   <INPUT TYPE="submit" VALUE="Update"></td>    <td><TEXTAREA NAME="mark_os_sun" ROWS=1 COLS=10></TEXTAREA>
<INPUT TYPE="submit" VALUE="Update"></td>  </tr>  <tr>
    <td>Monday:</td>    <td><TEXTAREA NAME="mark_av_mon" ROWS=1 COLS=10></TEXTAREA>
<INPUT TYPE="submit" VALUE="Update"></td>
    <td><TEXTAREA NAME="mark_os_mon" ROWS=1 COLS=10></TEXTAREA> <INPUT TYPE="submit" VALUE="Update"></td>  </tr>  <tr>    <td>Tuesday:</td>
    <td><TEXTAREA NAME="mark_av_tues" ROWS=1 COLS=10></TEXTAREA> <INPUT TYPE="submit" VALUE="Update"></td> <td><TEXTAREA NAME="mark_os_tues" ROWS=1 COLS=10></TEXTAREA><INPUT TYPE="submit" VALUE="Update"></td>  </tr>  <tr>    <td>Wednesday:</td>
    <td><TEXTAREA NAME="mark_av_wed" ROWS=1 COLS=10></TEXTAREA> <INPUT TYPE="submit" VALUE="Update"></td>  <td><TEXTAREA NAME="mark_os_wed" ROWS=1 COLS=10></TEXTAREA> <INPUT TYPE="submit" VALUE="Update"></td>  </tr>  <tr>    <td>Thursday:</td>
    <td><TEXTAREA NAME="mark_av_thurs" ROWS=1 COLS=10></TEXTAREA>   <INPUT TYPE="submit" VALUE="Update"></td>    <td>  <TEXTAREA NAME="mark_os_thurs" ROWS=1 COLS=10></TEXTAREA>
<INPUT TYPE="submit" VALUE="Update"> </td>  </tr>  <tr>
    <td>Friday:</td>    <td>  <TEXTAREA NAME="mark_av_fri" ROWS=1 COLS=10></TEXTAREA>   
<INPUT TYPE="submit" VALUE="Update"></td>
    <td>  <TEXTAREA NAME="mark_os_fri" ROWS=1 COLS=10></TEXTAREA>   <INPUT TYPE="submit" VALUE="Update"> </td>  </tr>  <tr>    <td>Saturday:</td>
    <td>  <TEXTAREA NAME="mark_av_sat" ROWS=1 COLS=10></TEXTAREA>   
<INPUT TYPE="submit" VALUE="Update"> </td>    <td>        <TEXTAREA NAME="mark_os_sat" ROWS=1 COLS=10></TEXTAREA>
<INPUT TYPE="submit" VALUE="Update"></td>  </tr>
</table>
</FORM>
</html>

In proc.php place your procedure for process of Form

ckwall

Postby ckwall » Fri Jan 17, 2003 7:27 am

what would be in proc.php? That's the part I dont know how to do.

User avatar
WiZARD
Moderator
Moderator
Posts: 1257
Joined: Thu Jun 20, 2002 10:14 pm
Location: Ukraine, Crimea, Simferopol
Contact:

Postby WiZARD » Sat Jan 18, 2003 2:00 am

In proc.php you get a array from prev page
$allKeys = array_keys($HTTP_POST_VARS);
and you may manipulate this


Return to “PHP General”

Who is online

Users browsing this forum: Exabot [Bot], Yahoo [Bot] and 1 guest