Jump to content

Archived

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

aoneill

Form reloads

Recommended Posts

After updating my database the form reloads. I need it to load a THANK YOU! html file only. I'm not sure if I'm using action="<?php echo $_SERVER['PHP_SELF'];?>" correctly. Thank you!


<form action="<?php echo $_SERVER['PHP_SELF'];?>" method="post">
<input type="hidden" name="user_id" value="<?php echo $row['user_id'];?>">
<table id="wrapper">
<tr align="center" bgcolor="#333333">
<td colspan="4"><p><span class="style7">Henry County RC Club<br>
P.O. Box 3268<br>
McDonough, GA. 30253-9998<br>
Membership / Renewal Application Form</span></p></td>
</tr>
<tr align="center" bgcolor="#333333">
<td colspan="4"><p><span class="style7">Please make the necessary changes and click UPDATE to complete the process.<br>
Fields marked * are required.</span></p></td>
</tr>
<tr bgcolor="#333333">
<td align="center"><span class="type style8">* First Name</span><span class="type style3"></span></td>
<td height="1"><input name="first_name" type="text" id="first_name" value="<?php echo $row['first_name'];?>" size="25" />
<td align="center" class="type style8">* Last Name</td>
<td height="1"> <input name="last_name" type="text" id="last_name" value="<?php echo $row['last_name'];?>" size="25" /></td>
</tr>
<tr bgcolor="#333333">
<td align="center" span class="style8">* Address</span></td>
<td colspan="3"><input name="address" type="text" id="address" value="<?php echo $row['address'];?>" size="30" /></td>
</tr>
<tr bgcolor="#333333">
<td align="center" span class="style8">Address 2</td>
<td colspan="3"> <input name="address_2" type="text" id="address_2" value="<?php echo $row['address_2'];?>" size="30" /></td>
</tr>
<tr bgcolor="#333333">
<td align="center" class="type style8">* City</td>
<td> <input name="city" type="text" id="city" value="<?php echo $row['city'];?>" size="25" />
<td align="center" class="type style8">* State</td>
<td width="0"> <input name="state" type="text" id="state" value="<?php echo $row['state'];?>" size="15" /></td>
</tr>
<tr bgcolor="#333333">
<td align="center" class="type style8">* Zip</td>
<td colspan="3"> <input name="zip" type="text" id="zip" value="<?php echo $row['zip'];?>" size="10" /></td>
</tr>
<tr bgcolor="#333333">
<td align="center" class="type style8">* Daytime Phone</td>
<td> <input name="day_phone" type="text" id="day_phone" value="<?php echo $row['day_phone'];?>" size="12" /></td>
<td align="center" class="type style8">Evening Phone</td>
<td width="0"> <input name="night_phone" type="text" id="night_phone" value="<?php echo $row['night_phone'];?>" size="12" /></td>
</tr>
<tr bgcolor="#333333" >
<td align="center" class="type style8">Cell Phone</td>
<td colspan="3"> <input name="cell_phone" type="text" id="cell_phone" value="<?php echo $row['cell_phone'];?>" size="12" /></td>
</tr>
<tr bgcolor="#333333">
<td align="center" class="type style8">* Email</td>
<td> <input name="email" type="text" id="email" value="<?php echo $row['email'];?>" size="30"></td>
<td align="center" class="type style8">* AMA#</td>
<td width="0"> <input name="ama" type="text" id="ama" value="<?php echo $row['ama'];?>" size="15" /></td>
</tr>
<tr bgcolor="#333333">
<td colspan="4" align="right">
<input type="submit" name="submit" value="submit" /></td>

</tr>
</table>
</form>

<?php





if (isset($_POST['submit']))

{
$row = $_POST['user_id'];
$f_name = $_POST['first_name'];
$l_name= $_POST['last_name'];
$f_address= $_POST['address'];
$s_address= $_POST['address_2'];
$city= $_POST['city'];
$state= $_POST['state'];
$zip= $_POST['zip'];
$day_phone= $_POST['day_phone'];
$night_phone= $_POST['night_phone'];
$cell_phone= $_POST['cell_phone'];
$email= $_POST['email'];
$ama= $_POST['ama'];

$query = "UPDATE member_data SET first_name= '$f_name', last_name= '$l_name', address= '$f_address', address_2= '$s_address', city= '$city', state= '$state', zip= '$zip',
day_phone= '$day_phone', night_phone= '$night_phone', cell_phone= '$cell_phone', email= '$email', ama= '$ama' WHERE user_id= '$row'";



$result = mysql_query($query);


include '../member_update/app_received.html'; // load thank you page


}



?>

Share this post


Link to post
Share on other sites
instead of useing $_SERVER[PHP_SELF] i just have the the form action to the pagename (example form.php)


[code]
<form method="post" action="yourformpage.php">
<input type="hidden" name="user_id" value="<?php echo $row['user_id'];?>">
<table id="wrapper">
<tr align="center" bgcolor="#333333">
<td colspan="4"><p><span class="style7">Henry County RC Club<br>
P.O. Box 3268<br>
McDonough, GA. 30253-9998<br>
Membership / Renewal Application Form</span></p></td>
</tr>
<tr align="center" bgcolor="#333333">
<td colspan="4"><p><span class="style7">Please make the necessary changes and click UPDATE to complete the process.<br>
Fields marked * are required.</span></p></td>
</tr>
<tr bgcolor="#333333">
<td align="center"><span class="type style8">* First Name</span><span class="type style3"></span></td>
<td height="1"><input name="first_name" type="text" id="first_name" value="<?php echo $row['first_name'];?>" size="25" />
<td align="center" class="type style8">* Last Name</td>
<td height="1"> <input name="last_name" type="text" id="last_name" value="<?php echo $row['last_name'];?>" size="25" /></td>
</tr>
<tr bgcolor="#333333">
<td align="center" span class="style8">* Address</span></td>
<td colspan="3"><input name="address" type="text" id="address" value="<?php echo $row['address'];?>" size="30" /></td>
</tr>
<tr bgcolor="#333333">
<td align="center" span class="style8">Address 2</td>
<td colspan="3"> <input name="address_2" type="text" id="address_2" value="<?php echo $row['address_2'];?>" size="30" /></td>
</tr>
<tr bgcolor="#333333">
<td align="center" class="type style8">* City</td>
<td> <input name="city" type="text" id="city" value="<?php echo $row['city'];?>" size="25" />
<td align="center" class="type style8">* State</td>
<td width="0"> <input name="state" type="text" id="state" value="<?php echo $row['state'];?>" size="15" /></td>
</tr>
<tr bgcolor="#333333">
<td align="center" class="type style8">* Zip</td>
<td colspan="3"> <input name="zip" type="text" id="zip" value="<?php echo $row['zip'];?>" size="10" /></td>
</tr>
<tr bgcolor="#333333">
<td align="center" class="type style8">* Daytime Phone</td>
<td> <input name="day_phone" type="text" id="day_phone" value="<?php echo $row['day_phone'];?>" size="12" /></td>
<td align="center" class="type style8">Evening Phone</td>
<td width="0"> <input name="night_phone" type="text" id="night_phone" value="<?php echo $row['night_phone'];?>" size="12" /></td>
</tr>
<tr bgcolor="#333333" >
<td align="center" class="type style8">Cell Phone</td>
<td colspan="3"> <input name="cell_phone" type="text" id="cell_phone" value="<?php echo $row['cell_phone'];?>" size="12" /></td>
</tr>
<tr bgcolor="#333333">
<td align="center" class="type style8">* Email</td>
<td> <input name="email" type="text" id="email" value="<?php echo $row['email'];?>" size="30"></td>
<td align="center" class="type style8">* AMA#</td>
<td width="0"> <input name="ama" type="text" id="ama" value="<?php echo $row['ama'];?>" size="15" /></td>
</tr>
<tr bgcolor="#333333">
<td colspan="4" align="right">
<input type="submit" name="submit" value="submit" /></td>

</tr>
</table>
</form>

<?php





if (isset($_POST['submit']))

{
$row = $_POST['user_id'];
$f_name = $_POST['first_name'];
$l_name= $_POST['last_name'];
$f_address= $_POST['address'];
$s_address= $_POST['address_2'];
$city= $_POST['city'];
$state= $_POST['state'];
$zip= $_POST['zip'];
$day_phone= $_POST['day_phone'];
$night_phone= $_POST['night_phone'];
$cell_phone= $_POST['cell_phone'];
$email= $_POST['email'];
$ama= $_POST['ama'];

$query = "UPDATE member_data SET first_name= '$f_name', last_name= '$l_name', address= '$f_address', address_2= '$s_address', city= '$city', state= '$state', zip= '$zip',
day_phone= '$day_phone', night_phone= '$night_phone', cell_phone= '$cell_phone', email= '$email', ama= '$ama' WHERE user_id= '$row'";



$result = mysql_query($query);


header("location: ../member_update/app_received.html");// redirect to  thank you page


}



?>
[/code]
and if you want to redirect them to the thankyou page you instead of trying to load it in within you form page you can change include to header("location: ../member_update/app_received.html")

Share this post


Link to post
Share on other sites
[!--quoteo(post=363563:date=Apr 11 2006, 03:47 AM:name=shortj75)--][div class=\'quotetop\']QUOTE(shortj75 @ Apr 11 2006, 03:47 AM) [snapback]363563[/snapback][/div][div class=\'quotemain\'][!--quotec--]
instead of useing $_SERVER[PHP_SELF] i just have the the form action to the pagename (example form.php)
[code]
<form method="post" action="yourformpage.php">
<input type="hidden" name="user_id" value="<?php echo $row['user_id'];?>">
<table id="wrapper">
<tr align="center" bgcolor="#333333">
<td colspan="4"><p><span class="style7">Henry County RC Club<br>
P.O. Box 3268<br>
McDonough, GA. 30253-9998<br>
Membership / Renewal Application Form</span></p></td>
</tr>
<tr align="center" bgcolor="#333333">
<td colspan="4"><p><span class="style7">Please make the necessary changes and click UPDATE to complete the process.<br>
Fields marked * are required.</span></p></td>
</tr>
<tr bgcolor="#333333">
<td align="center"><span class="type style8">* First Name</span><span class="type style3"></span></td>
<td height="1"><input name="first_name" type="text" id="first_name" value="<?php echo $row['first_name'];?>" size="25" />
<td align="center" class="type style8">* Last Name</td>
<td height="1"> <input name="last_name" type="text" id="last_name" value="<?php echo $row['last_name'];?>" size="25" /></td>
</tr>
<tr bgcolor="#333333">
<td align="center" span class="style8">* Address</span></td>
<td colspan="3"><input name="address" type="text" id="address" value="<?php echo $row['address'];?>" size="30" /></td>
</tr>
<tr bgcolor="#333333">
<td align="center" span class="style8">Address 2</td>
<td colspan="3"> <input name="address_2" type="text" id="address_2" value="<?php echo $row['address_2'];?>" size="30" /></td>
</tr>
<tr bgcolor="#333333">
<td align="center" class="type style8">* City</td>
<td> <input name="city" type="text" id="city" value="<?php echo $row['city'];?>" size="25" />
<td align="center" class="type style8">* State</td>
<td width="0"> <input name="state" type="text" id="state" value="<?php echo $row['state'];?>" size="15" /></td>
</tr>
<tr bgcolor="#333333">
<td align="center" class="type style8">* Zip</td>
<td colspan="3"> <input name="zip" type="text" id="zip" value="<?php echo $row['zip'];?>" size="10" /></td>
</tr>
<tr bgcolor="#333333">
<td align="center" class="type style8">* Daytime Phone</td>
<td> <input name="day_phone" type="text" id="day_phone" value="<?php echo $row['day_phone'];?>" size="12" /></td>
<td align="center" class="type style8">Evening Phone</td>
<td width="0"> <input name="night_phone" type="text" id="night_phone" value="<?php echo $row['night_phone'];?>" size="12" /></td>
</tr>
<tr bgcolor="#333333" >
<td align="center" class="type style8">Cell Phone</td>
<td colspan="3"> <input name="cell_phone" type="text" id="cell_phone" value="<?php echo $row['cell_phone'];?>" size="12" /></td>
</tr>
<tr bgcolor="#333333">
<td align="center" class="type style8">* Email</td>
<td> <input name="email" type="text" id="email" value="<?php echo $row['email'];?>" size="30"></td>
<td align="center" class="type style8">* AMA#</td>
<td width="0"> <input name="ama" type="text" id="ama" value="<?php echo $row['ama'];?>" size="15" /></td>
</tr>
<tr bgcolor="#333333">
<td colspan="4" align="right">
<input type="submit" name="submit" value="submit" /></td>

</tr>
</table>
</form>

<?php
if (isset($_POST['submit']))

{
$row = $_POST['user_id'];
$f_name = $_POST['first_name'];
$l_name= $_POST['last_name'];
$f_address= $_POST['address'];
$s_address= $_POST['address_2'];
$city= $_POST['city'];
$state= $_POST['state'];
$zip= $_POST['zip'];
$day_phone= $_POST['day_phone'];
$night_phone= $_POST['night_phone'];
$cell_phone= $_POST['cell_phone'];
$email= $_POST['email'];
$ama= $_POST['ama'];

$query = "UPDATE member_data SET first_name= '$f_name', last_name= '$l_name', address= '$f_address', address_2= '$s_address', city= '$city', state= '$state', zip= '$zip',
day_phone= '$day_phone', night_phone= '$night_phone', cell_phone= '$cell_phone', email= '$email', ama= '$ama' WHERE user_id= '$row'";
$result = mysql_query($query);
header("location: ../member_update/app_received.html");// redirect to  thank you page
}
?>
[/code]
and if you want to redirect them to the thankyou page you instead of trying to load it in within you form page you can change include to header("location: ../member_update/app_received.html")
[/quote]


It worked! Thank You!!!


Share this post


Link to post
Share on other sites

×

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.