Jump to content

Form Action Help


unemployment

Recommended Posts

 

When I click the save changes button, I want the user to be brought back to profile.php. Right now they are being brought to editprofile.php. I currently have the form action set to editprofile.php . When the I change it to profile.php my fields won't update. Any thoughts as to where I went wrong?

 

Here is the editprofile.php code.

 

<form action='editprofile.php' method="POST" id="form">

Link to comment
https://forums.phpfreaks.com/topic/217014-form-action-help/
Share on other sites

your form processing script is probably  in your editprofile.php page. once you are done with the script and if everything goes as planned  , you need to redirect to the page using the header() function,...like

 

header('Location:profile.php');

Be sure to exit() the script after the header function

Link to comment
https://forums.phpfreaks.com/topic/217014-form-action-help/#findComment-1127147
Share on other sites

You need to either

A) use a header() redirect back to profile.php after the editprofile.php script completes successfully, or

B) submit profile.php to itself, and conditionally incorporate the code from editprofle.php either directly or via an include() if the form has been submitted.

 

Option A is probably the best bet as it will also help prevent accidental double submission.

Link to comment
https://forums.phpfreaks.com/topic/217014-form-action-help/#findComment-1127148
Share on other sites

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.