0

I am working for a QA forum. I have a question and searched for that but did not find any better solution. In the login system, I am getting redirect_to URL like-

http://localhost:8081/qa/506/how-to-connect-the-html-page-to-the-mysql-database-using-php#ans123 

This is what I will use after login. I know, I can use <a name="ans123"></a> to jump section or by id .

  1. I am Getting value from the URL like -

    login.php?redirect_to=http://localhost:8081/qa/506/how-to-connect-the-html-page-to-the-mysql-database-using-php#ans123

    redirect_to=$_GET['redirect_to'];

but it gives me only http://localhost:8081/qa/506/how-to-connect-the-html-page-to-the-mysql-database-using-php

not

http://localhost:8081/qa/506/how-to-connect-the-html-page-to-the-mysql-database-using-php#ans123 

with #ans123 .

I want to jump the user to textarea after login on to the question page.

I have a textarea in then bottom with name="textarea"

<a name="ans123"> </a>
<form action="#" method="POST">
  <textarea name="anscontent" required></textarea>
  <script>
    CKEDITOR.replace("anscontent", {
      height: 300,
      filebrowserUploadUrl: "upload.php",
    });
  </script>

  <button name="answer_submit">Post your Answer</button>
</form>

One more thing, I have seen a method like

 http://localhost:8081/qa/506/how-to-connect-the-html-page-to-the-mysql-database-using-php?state=ans-890 . 

If I open this URL it opens textarea.

  1. How can I jump to the Textarea box area after login (Bottom HTML text editor)
  2. How can I edit the answer. if the user clicks on the edit button or link then jump to textbox and edit data. After the edit submitted jump to the updated answer.
Mario Petrovic
  • 7,500
  • 14
  • 42
  • 62
Vishal Rana
  • 53
  • 1
  • 1
  • 10
  • [Please do better research next time](https://stackoverflow.com/questions/2317508/get-fragment-value-after-hash-from-a-url-in-php) – Definitely not Rafal Dec 02 '20 at 09:34
  • 1
    In the redirect_to you should urlencode the # to %23 so that the php script can see it and redirect the user properly after login. – Simon Dec 02 '20 at 11:18

0 Answers0