Jump to content

Form reloads


aoneill

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


}



?>
Link to comment
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")
Link to comment
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!!!


Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

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