Hello,
I have all my php documents in one folder to handle my form creating, and i have all my html
files in one directory as well. but in my php code i want when a user click on the hyperlink in php page it shoud yake the user to my index.html but the link is there not responingto click,could some one tell me the best way to redirect a user from php page to html page

<?php
 /* Program: New_member.php
  * Desc:    Displays the new member welcome page. Greets
             member by name and gives a choice to enter
  *          restricted section or go back to main page.  */  
  session_start();  

  if (@$_SESSION['auth'] != "yes")  
  {
     header("Location: login.php");
     exit();
  }
  include("dogs.inc");  
  $cxn = mysqli_connect($host,$user,$passwd,$dbname)    
         or die ("Couldn't connect to server.");    
  $sql = "SELECT firstName,lastName FROM Member 
               WHERE loginName='{$_SESSION['logname']}'";
  $result = mysqli_query($cxn,$sql)
            or die("Couldn't execute query");
  $row = mysqli_fetch_assoc($result);
  extract($row);
  echo "<html>
        <head><title>New Member Welcome</title></head>
        <body>
        <h2 style='margin-top: .7in; text-align: center'>
        Welcome $firstName $lastName</h2>\n";    
?>      
<p>Your new Member Accountcreated</p>

<form action="SecretPage.html" method="post">    
   <input type="submit" 
          value="Enter the Members Only Section">
</form>

<form action="file:///C|/Users/0382/xampp/htdocs/dia/index.html" method="post">  
   <input type="submit" value="Go to my home Page">
</form>
</div>
</body></html>

i have triedd it in two different ways but not working

The form action should be an absolute or relative path from the webroot directory.

Looking at the file path you've included, I would suggest changing your form action to:
<form action="/dia/index.html" method="post">

Why a form button for redirection? You can use hyperlink/images/button(not form) instead.

@Javvy - good question.

@onofej - yes, you could use a hyperlink. E.g. <a href="/dia/index.html" title="Home">Go to my home page</a>

Thanks very much for your time but i wrote it this way still not redirecting to the index.html not responding on click

  <a href="file:///C|/Users/0382/xampp/htdocs/dia/index.html"  title="Home">Go to my home page</a>`

but instead, the url tried to get the index.html from
http://localhost/dia/source where all my php files are located, and not where the http file are in htdocs. probaly i need to include or header something i am not doing right could you help please

could someone tell me why this code <a href="https://twitter.com/angela_bradley">My Twitter</a> work perfectly from my php page by redirecting and this code

<a href="file:///C|/Users/0382/xampp/htdocs/cidia/index.html">dia</a> 

doesnt

<a href="/dia/index.html" title="Home">Go to my home page</a>

Have you tried this yet?

If it's not working, you're going to have to outline your website file structure from the webroot.

could someone tell me why this code `<a href="https://twitter.com/angela_bradley">My Twitter</a> work perfectly from my php page by redirecting and this code
<a href="file:///C|/Users/0382/xampp/htdocs/cidia/index.html">dia</a> doesnt

this is because https://twitter.com/angela_bradely is complete web link but the other one that you mentioned is not a standard http link. you should use standard http link to access that file over the server

just add the followingcode

<?
echo "<a href=" your html age address></a>";
?>

try this you will get the result

Thank you all for your time toresolve developers and programmers issues i can finnaly redirect properlly to my index.html after using this code from bluebloc. thank you

<a href="/dia/index.html" title="Home">Go to my home page</a> 

the code works

Member Avatar for diafol

@ag99110011
Please don't encourage the use of short tags. They're bad.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.