0

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

6
Contributors
10
Replies
12
Views
4 Years
Discussion Span
Last Post by diafol
0

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">

0

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

0

@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>

0

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

Edited by diafol: code tags

0

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

Edited by diafol: code tags

0

<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.

0

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

0

just add the followingcode

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

try this you will get the result

Edited by diafol: code tags

0

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

Edited by diafol: code tags

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.