Hello guys, i used hidden tag to redirect my form after process, an inside that tag i used $_SERVER['HTTP_REFERER'] what the problem is that when it completes its process, it redirects me to my localhost instead of previous url. for example: i submitted from mydomain.com/myfolder/mypage.php after process it takes me to mydomain.com any help, ideas??
Maybe because the variable is empty or not set. You can't rely on the HTTP_REFERER because it's defined by the browser, and not all browsers send it, and it can be modified by the user. Don't rely on it, or make sure it contains actually a value before redirecting.
Thanks for reply, actually following is the form which i have included in my page to submit and redirect to that page.. <form method=POST action="{$COM_CONF['script_url']}"> <input type=hidden name="action" value="add"> <input type="hidden" name="href" value="{$_SERVER['HTTP_REFERER']}" /> <table width="100%" border="0" cellspacing="1" cellpadding="2" align="center"> <tr> <td width="83" align="right"><font color="red">*</font>{$COM_LANG['Name']}: </td> <td width="196" align="left"> <input type=text name="disc_name" maxlength=40 size=30> <input type=hidden name="r_disc_name" value="{$COM_LANG['r_disc_name']}"> </td> </tr> <tr> <td width="83" align="right">{$COM_LANG['E-mail']}:</font></td> <td width="196" align="left"> <input type="Text" name="disc_email" size="30" maxlength="70"> </td> </tr> <tr> <td width="83"></td> <td width="196" align="left"> <input type="checkbox" name="email_me"><font size=1><nobr>{$COM_LANG['Notify']}</nobr></font><br> <input type="checkbox" name="dont_show_email" CHECKED><font size=1><nobr>{$COM_LANG['Dont_show_email']}</nobr></font><br> </td> </tr> <tr> <td valign="top" width="83" align="right"> <font color="red">*</font>{$COM_LANG['Text']}: </td> <td valign="top" width="196" align="left"> <textarea name="disc_body" cols="40" rows="13" wrap="VIRTUAL"></textarea> <input type=hidden name="r_disc_body" value="{$COM_LANG['r_disc_text']}"> </td> </tr> <tr> <td valign="top" width="83" align="right"> </td> <td valign="top" width="196"> <div align="center"> <input type="submit" name="Submit" value="{$COM_LANG['Submit']}"> </div> </td> </tr> </table> </form> PHP: mypage.php contains include("path to it"); when it is submitted, the browser takes it to my localhost. please tell me which command should i used to get through this problem..
well thanks nico for your help, i solved the problem myself. Actually i was including that file on my page which was creating this problem, now i used require() instead of include. it worked for me. cheers