After registration (in PDO), direct the page to index.html

Asked

Viewed 151 times

0

I’m using HTML and PHP. The connection to the database works, it registers the entered data and everything. Next, I open index.html, it has the option that leads me to the registration page:

<li><a href="http://localhost/middleearth/form-add.php">REGISTRAR</a></li>

This form-add.php shows me the form and registration and, in a file called add.php, I open the connection for insertion in the database. In this same add.php, I have:

header('Location: register_ok.php');

This register_ok.php informs that the registration has been successfully performed and gives the link to go back to index.html:

<div id="options" class="container text-center">
<h2>CADASTRO</h2>
<p>Cadastro efetuado com sucesso! </p>
<a href="file:///C:/xampp/htdocs/middleearth/personagens.html">Ir para a Tela Inicial</a>
<br>

That’s where my problem lies. I know it can be a really dumb thing to do, but I just can’t point it back to index.html so it can go back home and request login. I click on the link and it does not open. I have tried header also and nothing. The question is, php. files accessed by localhost/project folder seem not to accept this targeting for files on .html. Someone can give me a strength?

  • file:///C:/xampp/htdocs/middleearth/personagens.html? Would not be http://localhost/middleearth/

  • I tried with "http://localhost/middleearth/" too. But it opens the page. html without the images that originally have in it and, its links do not work.

  • Can print and insert into question? This really hard to see what happens

  • It should look like this: https://1drv.ms/i/s! Agqaayt29g0iw3t9z97bcjehrtxt But by setting the localhost/middleearth it looks like this: https://1drv.ms/i/s! Agqaayt29g0iw3o3wavk0xbqjgpa

  • Vinicius, I swear that these images have not helped in much to understand what is really happening rs debug on the console and see what the error

  • Probably the images are only not being loaded because the localhost path is created (and managed) by a route in xampp, if you correct in index.html this will be fixed too, only this is in achism, why is it not very clear ;/

  • 1

    Face this seems to be only the paths of images, would post the code? would be easier to help

Show 2 more comments

1 answer

1

Do the following:

Check the flow of your application, maybe they are not loading because the flow when being requested the page, it is not going through some script that she was supposed to have passed.

Don’t use that header('location'...), If you’re calling a page, use a require("register_ok.php")

When you use the header(), make sure no output has been sent yet.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.