Page 2 of 2
Posted: Mon Oct 28, 2002 9:35 am
by Crashin
Try echoing your query on the edit page to see what you're pulling up. Also, try echoing the value of the variable being passed to the edit page.
Posted: Mon Oct 28, 2002 3:14 pm
by MKEMouse
Thanks for getting back to me. Maybe I will send you some Wisconsin products (not beer or cheese) when this all over.
Here is how the current edit page looks I cut some extraneous info. out. I am echoing out the variable values to a table of form fields as you will see below. I just don't know why the only variable that is passed from the display page is the member_id. Shouldn't the corresponding variable data be parsed to the edit page as well?
<?php
if (!$db) {
echo "Could not change into the database";
exit;
}
//populate edit screen with right member's info.-----------
//
if($_SERVER['REQUEST_METHOD']=="POST" && isset($_POST['submit'])) {
$sql = "UPDATE member_table SET l_name='$l_name',m_name='$m_name',f_name='$f_name',street='$address',city='$thecity',state='$thestate',zip='$thezip',phone='$thephone',email='$theemail',expiration='$expiration' WHERE member_id='$radiobutton'";
$result =@mysql_query($sql) or die(mysql_error());
echo "<b>$f_name $l_name</b> has been modified.\n";
echo "<a href=\"http://fffffffff/wqimember_display.php\" window.status=\"\">Edit another member</a>";
}
?>
<form method="post" name="theform" action="edit_wqi_member.php">
<TABLE border=0 cellPadding=0 width="100%">
<TBODY>
<TR bgColor=#003366>
<TD colSpan=3 align=center><B class="tdw"> WQI Online - Edit Member
Screen </B></TD>
</TR>
<TR bgColor=#6999CCcc>
<TD colSpan=3><B class="tdw"> <font color="#FFFFFF"><span class="tdb">MEMBER
INFORMATION</span></font></B></TD>
</TR>
<TR>
<TD width="24%" class="td"><?php echo $radiobutton ?> First Name:</TD>
<TD width="34%"> <input type="Text" name="f_name" value="<?php echo $firstname ?>">
<span class="td1r">* </span></TD>
<TD width="20%"> </TD>
</TR><TR>
<INPUT type="hidden" name="member_id" value="<?php echo $myrow["member_id"] ?>">
<TR>
<TD width="24%" class="td">Middle Name:</TD>
<TD width="34%"> <INPUT type="Text" name="m_name" value="<?php echo $middlename ?>">
<span class="td1r">*</span> </TD>
<TD width="20%"> </TD>
</TR>
<TR>
<TD width="24%" class="td">Last Name:</TD>
<TD width="34%"> <INPUT type="Text" name="l_name" value="<?php echo $lastname ?>"> <span class="td1r">*</span> </TD>
<TD width="20%"> </TD>
</TR>
<TR>
<TD width="24%" class="td">Street Address:</TD>
<TD width="34%"> <input type="text" name="address" value="<?php echo $street ?>">
<span class="td1r"> *</span> </TD>
</TR>
<TR>
<TD height=25 width="24%" class="td">City:</TD>
<TD height=25 width="34%"> <input type="text" name="thecity" value="<?php echo $city ?>">
<span class="td1r">*</span> </TD>
</TR>
<TR>
<TD width="24%" class="td">State:</TD>
<TD width="34%"> <select name=thestate size=1>
<option selected value="<?php echo $myrow["state"] ?>"><?php echo $state ?></option>
<option value="AL">AL</option>
<option value="AK">AK</option>
<option value="AR">AR</option>
<option value="AZ">AZ</option>
<option value="CA">CA</option>
<option value="CO">CO</option>
<option value="CT">CT</option>
<option value="DE">DE</option>
<option value="DC">DC</option>
<option value="FL">FL</option>
<option value="HI">HI</option>
<option value="IA">IA</option>
<option value="ID">ID</option>
<option value="IL">IL</option>
<option value="IN">IN</option>
<option value="KS">KS</option>
<option value="KY">KY</option>
<option value="LA">LA</option>
<option value="ME">ME</option>
<option value="MD">MD</option>
<option value="MA">MA</option>
<option value="MI">MI</option>
<option value="MN">MN</option>
<option value="MS">MS</option>
<option value="MO">MO</option>
<option value="MT">MT</option>
<option value="NE">NE</option>
<option value="NV">NV</option>
<option value="NH">NH</option>
<option value="NJ">NY</option>
<option value="NM">NJ</option>
<option value="NM">NM</option>
<option value="NY">NY</option>
<option value="NC">NC</option>
<option value="ND">ND</option>
<option value="OH">OH</option>
<option value="OK">OK</option>
<option value="OR">OR</option>
<option value="PA">PA</option>
<option value="RI">RI</option>
<option value="SC">SC</option>
<option value="SD">SD</option>
<option value="TN">TN</option>
<option value="TX">TX</option>
<option value="UT">UT</option>
<option value="VT">VT</option>
<option value="VA">VA</option>
<option value="WA">WA</option>
<option value="WV">WV</option>
<option value="WI">WI</option>
<option value="WY">WY</option>
</select> <span class="td1r">*</span> </TD>
<TD rowSpan=3 width="20%"> </TD>
</TR>
<TR>
<TD height=35 width="24%" class="td">Zip Code:</TD>
<TD height=35 width="34%"> <input maxlength=10 name="thezip" size=8 value="<?php echo $zip ?>" />
<span class="td1r">*</span> </TD>
<TD height=35 width="22%"> </TD>
</TR>
<TR>
<TD height=24 width="24%" class="td">Tel:</TD>
<TD height=24 width="34%"> <input name="thephone" type="Text" id="phone" size=12 value="<?php echo $phone ?>">
<span class="td1r">* </span></TD>
<TD height=24 width="22%"> </TD>
</TR>
<TR>
<TD height=27 width="24%" class="td"> Email:</TD>
<TD height=27 width="34%"> <input type="text" name="theemail" value="<?php echo $email ?>">
<span class="td1r">* </span></TD>
<TD height=27 width="20%"> </TD>
</TR><TR>
<TD width="24%" class="td">Expiration Year:</TD>
<TD width="34%"> <select name=expiration size=1>
<option selected value="">[Select one]</option>
<option value="2003">2003</option>
<option value="2004">2004</option>
<option value="2005">2005</option>
<option value="2006">2006</option>
<option value="2007">2007</option>
<option value="2008">2008</option>
<option value="2009">2009</option>
<option value="2010">2010</option>
<option value="2011">2011</option>
<option value="2012">2012</option>
</select> <span class="td1r">*</span> </TD>
<TD rowSpan=3 width="20%"> </TD>
</TR>
</TBODY>
</TABLE>
<TABLE width=78%>
<TBODY>
<TR bgColor=#003366>
<TD align=right colSpan=5 vAlign=top> <input name="submit" type="submit" value="Submit" onClick="javascript:validate_form(this)" />
<BR>
<DIV align=center> </DIV>
</TD>
</TR>
</TBODY>
</TABLE>
I echoed the member_id to both the display page and edit page and found that when the edit(submit) button on the display page was hit after the radio button was clicked that the value was passed, but that was all that was passed.
Thanks again.

Posted: Mon Oct 28, 2002 9:23 pm
by MKEMouse
Okay you saw my edit page code I added
Code:
Code: Select all
$query = "SELECT * FROM member WHERE member_id='$member_id'";
$result = mysql_query($query) or die("Cannot perform MEMBER query.");
$row = mysql_fetch_array($result);
As you recommended...and...a text string, $street appeared in the text field of the form, not the value of variable "$street."
$city appeared in the text field named "city" and all through to email.
The values for f_name, m_name, and l_name do not appear in the corresponding member name text fields at all.
Those fields are blank.
Bear with me here is the display page code, I cut out the css, and js stuff:
Code: Select all
<form name="form1" id="form1" method="post" action="edit_wqi_member.php?member_id=$radiobutton&l_name=$lastname&f_name=$firstname&m_name=$middlename&street=$street&city=$city&state=$state&zip=$zip&phone=$phone&email=$email">
<table width="760" cellspacing="2" cellpadding="0">
<tr>
<td rowspan="4" background="border.gif" width="51">
<table width="770" border="0" cellpadding="5" cellspacing="2" align="left"><tr>
<td width="517" height="63" align="center" bgcolor="#003366"></td>
</tr>
<?php
# require supportive stuff
require ("xxxxx/xxxxxxxconnect.php");
$db=mysql_select_db(DB_NAME);
if (!$db) {
echo "Could not change into the database";
exit;
}
// ------------- execute display query
$result1 = mysql_query("SELECT * FROM member_table WHERE expiration=2003");
while($row1 = mysql_fetch_array($result1)) {
?>
<br />
<tr>
<td bgcolor="#6999CC">
<?php echo $row1ї"member_id"]; ?>
<input type="radio" name="radiobutton" value="<?php echo $row1ї"member_id"]; ?>" />
<font face="Arial, Helvetica, sans-serif"><?php echo $row1ї"l_name"]; ?>, <?php echo $row1ї"m_name"]; ?>, <?php echo $row1ї"f_name"]; ?></font>
<input type="submit" name="Submit" value="Edit" /></td>
</tr>
<tr>
<td bgcolor="#FFFFCC"><font face="Arial, Helvetica, sans-serif"><?php echo $row1ї"street"]; ?>, <?php echo $row1ї"city"]; ?>, <?php echo $row1ї"state"]; ?>, <?php echo $row1ї"zip"]; ?></font></td>
</tr>
<tr>
<td bgcolor="#FFFFCC"><font face="Arial, Helvetica, sans-serif">Tel: <?php echo $row1ї"phone"]; ?> Email:<a href="mailto:<?php echo $row1ї"email"]; ?>"><?php echo $row1ї"email"]; ?></a></font></td>
</tr>
<?php
}
?>
</table>
<p> </p>
</td>
</tr></table></form></body>
I apologize for throwing more logs on the fire I don't know what to do anymore. I printed out the code and went over it with a highlighter marker but couldn't detect an error. I am using Dreamweaver to edit my PHP code so it doesn't detect any runtime problems. Maybe I should switch to <CFML>?

Posted: Mon Oct 28, 2002 10:03 pm
by MKEMouse
WOW the edit button option on this board times out quickly.
I have to keep posting another post I apologize. This is the newest
version of the edit page, the fields populate correctly.
I Got it. It updates the the db as well.
Thanks for all your suggestions. I would like to publish the code online shortly for anyone to use.

Posted: Wed Oct 30, 2002 10:37 am
by Crashin
Sorry I didn't get back to you before, but that's great! I'm glad it worked out!
