Link to home
Start Free TrialLog in
Avatar of FirstBorn
FirstBornFlag for United States of America

asked on

Input Form to Display Original webpage After Clicking Submit

Hi Everyone!

I have a webpage that has a few input text boxes that will call a php file to submit info to my e-mail address.  This procedure works well.  However, I Need a way to Show the current form with text displayed where the input boxes were at originally that reads:
"Your Request Has Been Submitted".

My webpage and script are below.

Thanks in Advance!

:)

FirstBorn

PS.  I'm Still kinda newbie-ish to php, so please explain thoroughly, if possible.
Thanks... :)

------------------
Testphp.html:
------------------
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

<HTML>
 
 <HEAD>
  <TITLE>Test Page
    </TITLE>
 </HEAD>
 
<table width="100%" border="0" cellpadding="0">
  <tr>
    <td width="20%" valign="top"><table cellpadding="0"

cellspacing="0" border="0" height="100%">
        <tr>
          <td><div align="center"><font face="Verdana, Arial,

Helvetica, sans-serif" color="#000000" size="5">&nbsp;Title
              </font></div></td>
        </tr>
        <tr>
          <td><img src="/_blnk.gif" width="150" height="5"></td>
        </tr>
        <tr>
          <td width="169" height="100%" valign="top"

style="padding-top:10px;padding-bottom:10px;padding-left:10px;">
            <table width="95%" border="0" cellpadding="10">
              <tr>
                <td><div align="center"></div></td>
              </tr>
<tr>
                <td><div align="center"><font size="2" face="Verdana,

Arial, Helvetica, sans-serif">My Page
</div></td>
              </tr>
              <tr>
                <td><div align="center"><a href="link1.html"><font

size="2" face="Verdana, Arial, Helvetica,

sans-serif">link1</font></a></div><BR>
<BR>



<div align="center"><a href="link2"><font size="2" face="Verdana,

Arial, Helvetica, sans-serif">Link 2</font></a></div></td>
</td>
<TR>
<TD>
<BR>
<BR>
<BR>

<div align="center"><B>This is what I need to Work, Thanks! ... :)
</B>
<font size="2" face="Verdana, Arial, Helvetica, sans-serif">
<form action="email.php" method="post">
<div align=left><B>Name</B></div>
<input type="text" name="name" size="20" maxlength="100"
value="">
<div align=left><B>E-mail</B></div>
<input type="text" name="email" size="20" maxlength="100"
value="">
<div align=left><B>Subject</B></div>
<input type="text" name="altsubject" size="20" maxlength="100"
value="">
<div align=left><B>Comments</B></div>
<textarea wrap=phyiscal rows="12" name="comments" cols="15"

></textarea>


<BR>
<input type="Submit" name="submit" value="Submit">
<input type="Reset">
<BR>
</form>
</TD>
</TR>

</font>
</div></td>

</tr>




</font></a></div></td>
</tr>
 

             </tr>

            </table>
</td>
        </tr>
        <tr>
          <td>&nbsp;</td>
        </tr>
      </table></td>
    <td width="80%" valign="top"><p><a name="top"></a></p>
      <table width="95%" border="0" align="center" cellpadding="10">
        <tr>
          <td valign="top"><table width="100%" border="1"

align="center" cellpadding="10">

   <TABLE>
<TR>

<TR>
      <TD>
<hr width="100%" align=center>

    <FONT FACE="Times" SIZE="5"><B>Title</B><BR></FONT>
<hr width="100%" align=center>

</TD>
      
</TR>
</TABLE>
<CENTER><FONT FACE="Times" SIZE="8" COLOR="#FF0000"><B>      

</B></FONT></CENTER>
   <FONT FACE="Times New Roman" SIZE="3">
<P>


<table  width="90%" border="0" cellspacing="0" cellpadding="0">
      <tr>
            <!-- Row 1 Column 1 -->
            <td  align="left">
                  
<table  width="90%" border="1" cellspacing="0" cellpadding="5">
      <tr>
            <!-- Row 1 Column 1 -->
            <td  align="left">
                  <div align='Left'>Please, kick off your

shoes, relax, and</div>
<div>Enjoy the articles included in the links below</div>
<P>This Archive was made JUST FOR YOU!</P>
<P>_</P>

<Div><A HREF="link3.html">Link3</A></Div>



<P>_</P>
</td>
      </tr>
</table>
            </td>
      </tr>
</table>

<br>
<br>
<hr width="100%" align=center>

    <FONT FACE="Times" SIZE="5"><B>More Links</B><BR></FONT>
<hr width="100%" align=center>
<P><A HREF="Link4.html">Link4</A></P>
<P><A HREF="Link5.html">Link5</A></P>
<P><A HREF="Link6.html">Link6</A></P>


</BODY>
</HTML>

--------------------------------
Testemail.php
--------------------------------
<HTML><Title>Testemail.php</Title><Body><Center></Center>&nbsp;

<?
// Load up from POST
$name=$_POST['name'];
$email=$_POST['email'];
$altsubject=$_POST['altsubject'];
$allinfo=$_POST['comments'];

$allinfo=nl2br($allinfo);

// Build message parts
//$recipient = "me@me.com";
$recipient = "me@email.com";
$subject = "Here's My Subject";
$message = "Name: $name\nEmail: $email\nAltSubject:

$altsubject\ncomments: $allinfo\n";
$from = "$email";

// Send mail
mail($recipient,$subject,$message,$from,$altsubject);

//I Believe that Here is Where I would like to display the current page   <-------
//(Testphp.html) with "Your Request Has Been Submitted"                   <-------
//Displayed Where the Input Boxes were Displayed.                             <-------

?>
</Body>
</HTML>
------------------------------

Avatar of lozloz
lozloz

hi,

why not just combine it into one php script? all i've done below is combine the two scripts together, add a clause so the mail is only sent if the form has been submitted, change the form to point to itself in the action and changed the input fields' values to be whatever's in the POST array

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

<HTML>
 
 <HEAD>
  <TITLE>Test Page
    </TITLE>
 </HEAD>
 
<?
if($_POST["name"]) {

// Load up from POST
$name=$_POST['name'];
$email=$_POST['email'];
$altsubject=$_POST['altsubject'];
$allinfo=$_POST['comments'];

$allinfo=nl2br($allinfo);

// Build message parts
//$recipient = "me@me.com";
$recipient = "me@email.com";
$subject = "Here's My Subject";
$message = "Name: $name\nEmail: $email\nAltSubject:

$altsubject\ncomments: $allinfo\n";
$from = "$email";

// Send mail
mail($recipient,$subject,$message,$from,$altsubject);
}
?>

<table width="100%" border="0" cellpadding="0">
  <tr>
    <td width="20%" valign="top"><table cellpadding="0"

cellspacing="0" border="0" height="100%">
        <tr>
          <td><div align="center"><font face="Verdana, Arial,

Helvetica, sans-serif" color="#000000" size="5">&nbsp;Title
              </font></div></td>
        </tr>
        <tr>
          <td><img src="/_blnk.gif" width="150" height="5"></td>
        </tr>
        <tr>
          <td width="169" height="100%" valign="top"

style="padding-top:10px;padding-bottom:10px;padding-left:10px;">
            <table width="95%" border="0" cellpadding="10">
              <tr>
                <td><div align="center"></div></td>
              </tr>
<tr>
                <td><div align="center"><font size="2" face="Verdana,

Arial, Helvetica, sans-serif">My Page
</div></td>
              </tr>
              <tr>
                <td><div align="center"><a href="link1.html"><font

size="2" face="Verdana, Arial, Helvetica,

sans-serif">link1</font></a></div><BR>
<BR>



<div align="center"><a href="link2"><font size="2" face="Verdana,

Arial, Helvetica, sans-serif">Link 2</font></a></div></td>
</td>
<TR>
<TD>
<BR>
<BR>
<BR>

<div align="center"><B>This is what I need to Work, Thanks! ... :)
</B>
<font size="2" face="Verdana, Arial, Helvetica, sans-serif">
<form action="<? print $_SERVER["PHP_SELF"]; ?>" method="post">
<div align=left><B>Name</B></div>
<input type="text" name="name" size="20" maxlength="100"
value="<? print $_POST["name"]; ?>">
<div align=left><B>E-mail</B></div>
<input type="text" name="email" size="20" maxlength="100"
value="<? print $_POST["email"]; ?>">
<div align=left><B>Subject</B></div>
<input type="text" name="altsubject" size="20" maxlength="100"
value="<? print $_POST["altsubject"]; ?>">
<div align=left><B>Comments</B></div>
<textarea wrap=phyiscal rows="12" name="comments" cols="15" ><? print $_POST["comments"]; ?></textarea>


<BR>
<input type="Submit" name="submit" value="Submit">
<input type="Reset">
<BR>
</form>
</TD>
</TR>

</font>
</div></td>

</tr>




</font></a></div></td>
</tr>
 

             </tr>

            </table>
</td>
        </tr>
        <tr>
          <td>&nbsp;</td>
        </tr>
      </table></td>
    <td width="80%" valign="top"><p><a name="top"></a></p>
      <table width="95%" border="0" align="center" cellpadding="10">
        <tr>
          <td valign="top"><table width="100%" border="1"

align="center" cellpadding="10">

   <TABLE>
<TR>

<TR>
     <TD>
<hr width="100%" align=center>

    <FONT FACE="Times" SIZE="5"><B>Title</B><BR></FONT>
<hr width="100%" align=center>

</TD>
     
</TR>
</TABLE>
<CENTER><FONT FACE="Times" SIZE="8" COLOR="#FF0000"><B>    

</B></FONT></CENTER>
   <FONT FACE="Times New Roman" SIZE="3">
<P>


<table  width="90%" border="0" cellspacing="0" cellpadding="0">
     <tr>
          <!-- Row 1 Column 1 -->
          <td  align="left">
               
<table  width="90%" border="1" cellspacing="0" cellpadding="5">
     <tr>
          <!-- Row 1 Column 1 -->
          <td  align="left">
               <div align='Left'>Please, kick off your

shoes, relax, and</div>
<div>Enjoy the articles included in the links below</div>
<P>This Archive was made JUST FOR YOU!</P>
<P>_</P>

<Div><A HREF="link3.html">Link3</A></Div>



<P>_</P>
</td>
     </tr>
</table>
          </td>
     </tr>
</table>

<br>
<br>
<hr width="100%" align=center>

    <FONT FACE="Times" SIZE="5"><B>More Links</B><BR></FONT>
<hr width="100%" align=center>
<P><A HREF="Link4.html">Link4</A></P>
<P><A HREF="Link5.html">Link5</A></P>
<P><A HREF="Link6.html">Link6</A></P>


</BODY>
</HTML>

cheers,

loz
incidentally it appears you're missing a <body> tag just below </HEAD>

loz
Avatar of FirstBorn

ASKER

Hi loz,

I put the page onto my web server, loaded it, and there is the following displaying:

1.  Right above the Main Text Input Boxes:

     This is what I need to Work, Thanks! ... :)
     " method="post">

2.  Inside the Text Box for Name, Email, and Subject it shows:

     "<? print $_POST["

3.  Inside the Text Box for Comments, it shows:

     <? print $_POST["comments"]; ?>

These text boxes need to be empty upon loading the page.

Thanks...

:)

FirstBorn
Hi loz,

Also, I click on 'Submit' and I get an "HTTP 404 - File not found" error.

Thanks...

:)

FirstBorn
Hi loz,

k... I got it to submit, I had to rename the file to index.php.

After Submitting, though, it doesn't tell the user that the information has been submitted, and keeps the text input boxes on the page with the text that has been submitted in the text input boxes... The User may not know that they had submitted the information and will probably keep resending the information... that is what I'm trying to avoid... :)

Also, I need the page to be named index.html.  Should I use an 'include' for the index.php to display the entire contents on the index.html file, and if so, how would I go about doing that?  Also, would it affect the functionality?

Thanks...

:)

FirstBorn
You could add a hidden value in the form, eg

<input type="hidden" name="process" value="yes">

then add this to where you want it to say it has been processed..

<?php
if ($_POST['process']=="yes") {
   echo "Form submitted";
}
?>

Of course, you could simply check an exisiting value, for example "name", but if they leave out the name field, it won't process. (i know you probably won't want it to process if they DO leave out the name, but validation is not what you asked for, although my way will make it easier to add validation script later..)

Good luck
hi,

those problems seem quite strange, maybe to do with the short tags. i've modified the script to be in two parts - i didn't realise you didn't want the information in text boxes after the mail is sent. filename.html:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

<HTML>
 
 <HEAD>
  <TITLE>Test Page
    </TITLE>
 </HEAD>
 <BODY>
<table width="100%" border="0" cellpadding="0">
  <tr>
    <td width="20%" valign="top"><table cellpadding="0"

cellspacing="0" border="0" height="100%">
        <tr>
          <td><div align="center"><font face="Verdana, Arial,

Helvetica, sans-serif" color="#000000" size="5">&nbsp;Title
              </font></div></td>
        </tr>
        <tr>
          <td><img src="/_blnk.gif" width="150" height="5"></td>
        </tr>
        <tr>
          <td width="169" height="100%" valign="top"

style="padding-top:10px;padding-bottom:10px;padding-left:10px;">
            <table width="95%" border="0" cellpadding="10">
              <tr>
                <td><div align="center"></div></td>
              </tr>
<tr>
                <td><div align="center"><font size="2" face="Verdana,

Arial, Helvetica, sans-serif">My Page
</div></td>
              </tr>
              <tr>
                <td><div align="center"><a href="link1.html"><font

size="2" face="Verdana, Arial, Helvetica,

sans-serif">link1</font></a></div><BR>
<BR>



<div align="center"><a href="link2"><font size="2" face="Verdana,

Arial, Helvetica, sans-serif">Link 2</font></a></div></td>
</td>
<TR>
<TD>
<BR>
<BR>
<BR>

<div align="center"><B>This is what I need to Work, Thanks! ... :)
</B>
<font size="2" face="Verdana, Arial, Helvetica, sans-serif">
<form action="filename.php" method="post">
<div align=left><B>Name</B></div>
<input type="text" name="name" size="20" maxlength="100">
<div align=left><B>E-mail</B></div>
<input type="text" name="email" size="20" maxlength="100">
<div align=left><B>Subject</B></div>
<input type="text" name="altsubject" size="20" maxlength="100">
<div align=left><B>Comments</B></div>
<textarea wrap=phyiscal rows="12" name="comments" cols="15" ></textarea>


<BR>
<input type="hidden" name="submit" value="Submit">
<input type="Submit" name="submit" value="Submit">
<input type="Reset">
<BR>
</form>
</TD>
</TR>

</font>
</div></td>

</tr>




</font></a></div></td>
</tr>
 

             </tr>

            </table>
</td>
        </tr>
        <tr>
          <td>&nbsp;</td>
        </tr>
      </table></td>
    <td width="80%" valign="top"><p><a name="top"></a></p>
      <table width="95%" border="0" align="center" cellpadding="10">
        <tr>
          <td valign="top"><table width="100%" border="1"

align="center" cellpadding="10">

   <TABLE>
<TR>

<TR>
     <TD>
<hr width="100%" align=center>

    <FONT FACE="Times" SIZE="5"><B>Title</B><BR></FONT>
<hr width="100%" align=center>

</TD>
     
</TR>
</TABLE>
<CENTER><FONT FACE="Times" SIZE="8" COLOR="#FF0000"><B>    

</B></FONT></CENTER>
   <FONT FACE="Times New Roman" SIZE="3">
<P>


<table  width="90%" border="0" cellspacing="0" cellpadding="0">
     <tr>
          <!-- Row 1 Column 1 -->
          <td  align="left">
               
<table  width="90%" border="1" cellspacing="0" cellpadding="5">
     <tr>
          <!-- Row 1 Column 1 -->
          <td  align="left">
               <div align='Left'>Please, kick off your

shoes, relax, and</div>
<div>Enjoy the articles included in the links below</div>
<P>This Archive was made JUST FOR YOU!</P>
<P>_</P>

<Div><A HREF="link3.html">Link3</A></Div>



<P>_</P>
</td>
     </tr>
</table>
          </td>
     </tr>
</table>

<br>
<br>
<hr width="100%" align=center>

    <FONT FACE="Times" SIZE="5"><B>More Links</B><BR></FONT>
<hr width="100%" align=center>
<P><A HREF="Link4.html">Link4</A></P>
<P><A HREF="Link5.html">Link5</A></P>
<P><A HREF="Link6.html">Link6</A></P>


</BODY>
</HTML>

filename.php

<HTML>
 
 <HEAD>
  <TITLE>Test Page
    </TITLE>
 </HEAD>
<?php
if($_POST["submit"]) {

// Load up from POST
$name=$_POST['name'];
$email=$_POST['email'];
$altsubject=$_POST['altsubject'];
$allinfo=$_POST['comments'];

$allinfo=nl2br($allinfo);

// Build message parts
//$recipient = "me@me.com";
$recipient = "me@email.com";
$subject = "Here's My Subject";
$message = "Name: $name\nEmail: $email\nAltSubject:

$altsubject\ncomments:" . $_POST["comments"] . "\n";
$from = "$email";

// Send mail
mail($recipient,$subject,$message,$from,$altsubject);
} else {
  print "No information sent to script";
}
?>
<font size="2" face="Verdana, Arial, Helvetica, sans-serif">
<div align=left><B>Name</B></div>
<?php print $name; ?>
<div align=left><B>E-mail</B></div>
<?php print $email; ?>
<div align=left><B>Subject</B></div>
<?php print $altsubject; ?>
<div align=left><B>Comments</B></div>
<?php print $allinfo; ?>
</BODY>
</HTML>

i changed part of your mail script because you don't want to use nl2br on the comments field in it - line breaks are \n in emails. you need to change the action of the form to suit your filename. if it doesn't work, can you take a view source and paste the result in here, or any relevant errors

cheers,

loz
Hi loz,

k, We seem to be back at Square One.

The Main Page name is index.html.

On index.html, the user enters their information and clicks submit.

When they submit the information, the information goes to my e-mail address.

I don't want another page to load, I would like the SAME Page to be viewed,

with the Exception of the input boxes.  Where the Input Boxes Were, I would like

to have displayed, "Your Information Has Been Sent.  Thank You."

Thanks...

:)

FirstBorn

-----------------
Hi rjdown,

Where in the file would I place this code?

As mentioned in the original thread:

"PS.  I'm Still kinda newbie-ish to php, so please explain thoroughly, if possible.
Thanks... :)"

Thanks...

:)

FirstBorn

you can't have an html parsed as php unless you add a file called .htaccess with the following line

AddType application/x-httpd-php .html

only works if you have apache though. then you have index.html:

<HTML>
 
 <HEAD>
  <TITLE>Test Page
    </TITLE>
 </HEAD>
 <BODY>
<?php
if($_POST["submit"]) {

// Load up from POST
$name=$_POST['name'];
$email=$_POST['email'];
$altsubject=$_POST['altsubject'];
$allinfo=$_POST['comments'];

$allinfo=nl2br($allinfo);

// Build message parts
//$recipient = "me@me.com";
$recipient = "me@email.com";
$subject = "Here's My Subject";
$message = "Name: $name\nEmail: $email\nAltSubject:

$altsubject\ncomments:" . $_POST["comments"] . "\n";
$from = "$email";

// Send mail
mail($recipient,$subject,$message,$from,$altsubject);
} else {
  print "No information sent to script";
}
?>

<table width="100%" border="0" cellpadding="0">
  <tr>
    <td width="20%" valign="top"><table cellpadding="0"

cellspacing="0" border="0" height="100%">
        <tr>
          <td><div align="center"><font face="Verdana, Arial,

Helvetica, sans-serif" color="#000000" size="5">&nbsp;Title
              </font></div></td>
        </tr>
        <tr>
          <td><img src="/_blnk.gif" width="150" height="5"></td>
        </tr>
        <tr>
          <td width="169" height="100%" valign="top"

style="padding-top:10px;padding-bottom:10px;padding-left:10px;">
            <table width="95%" border="0" cellpadding="10">
              <tr>
                <td><div align="center"></div></td>
              </tr>
<tr>
                <td><div align="center"><font size="2" face="Verdana,

Arial, Helvetica, sans-serif">My Page
</div></td>
              </tr>
              <tr>
                <td><div align="center"><a href="link1.html"><font

size="2" face="Verdana, Arial, Helvetica,

sans-serif">link1</font></a></div><BR>
<BR>



<div align="center"><a href="link2"><font size="2" face="Verdana,

Arial, Helvetica, sans-serif">Link 2</font></a></div></td>
</td>
<TR>
<TD>
<BR>
<BR>
<BR>

<div align="center"><B>This is what I need to Work, Thanks! ... :)
</B>
<font size="2" face="Verdana, Arial, Helvetica, sans-serif">
<?php
if($_POST["submit"]) {
?>
<font size="2" face="Verdana, Arial, Helvetica, sans-serif">
<div align=left><B>Name</B></div>
<?php print $name; ?>
<div align=left><B>E-mail</B></div>
<?php print $email; ?>
<div align=left><B>Subject</B></div>
<?php print $altsubject; ?>
<div align=left><B>Comments</B></div>
<?php print $allinfo; ?>
} else {
?>
<form action="<?php print $_SERVER["PHP_SELF"]; ?>" method="post">
<div align=left><B>Name</B></div>
<input type="text" name="name" size="20" maxlength="100">
<div align=left><B>E-mail</B></div>
<input type="text" name="email" size="20" maxlength="100">
<div align=left><B>Subject</B></div>
<input type="text" name="altsubject" size="20" maxlength="100">
<div align=left><B>Comments</B></div>
<textarea wrap=phyiscal rows="12" name="comments" cols="15" ></textarea>
<BR>
<input type="hidden" name="submit" value="Submit">
<input type="submit" name="submit" value="Submit">
<input type="reset">
<BR>
</form>
<?php } ?>
</TD>
</TR>

</font>
</div></td>

</tr>




</font></a></div></td>
</tr>
 

             </tr>

            </table>
</td>
        </tr>
        <tr>
          <td>&nbsp;</td>
        </tr>
      </table></td>
    <td width="80%" valign="top"><p><a name="top"></a></p>
      <table width="95%" border="0" align="center" cellpadding="10">
        <tr>
          <td valign="top"><table width="100%" border="1"

align="center" cellpadding="10">

   <TABLE>
<TR>

<TR>
     <TD>
<hr width="100%" align=center>

    <FONT FACE="Times" SIZE="5"><B>Title</B><BR></FONT>
<hr width="100%" align=center>

</TD>
     
</TR>
</TABLE>
<CENTER><FONT FACE="Times" SIZE="8" COLOR="#FF0000"><B>    

</B></FONT></CENTER>
   <FONT FACE="Times New Roman" SIZE="3">
<P>


<table  width="90%" border="0" cellspacing="0" cellpadding="0">
     <tr>
          <!-- Row 1 Column 1 -->
          <td  align="left">
               
<table  width="90%" border="1" cellspacing="0" cellpadding="5">
     <tr>
          <!-- Row 1 Column 1 -->
          <td  align="left">
               <div align='Left'>Please, kick off your

shoes, relax, and</div>
<div>Enjoy the articles included in the links below</div>
<P>This Archive was made JUST FOR YOU!</P>
<P>_</P>

<Div><A HREF="link3.html">Link3</A></Div>



<P>_</P>
</td>
     </tr>
</table>
          </td>
     </tr>
</table>

<br>
<br>
<hr width="100%" align=center>

    <FONT FACE="Times" SIZE="5"><B>More Links</B><BR></FONT>
<hr width="100%" align=center>
<P><A HREF="Link4.html">Link4</A></P>
<P><A HREF="Link5.html">Link5</A></P>
<P><A HREF="Link6.html">Link6</A></P>


</BODY>
</HTML>

cheers,

loz
Hi loz,

k, This didn't work...

My Webhost uses Apache 1.3.27 and php 4

How about a 'redirect' to the index.html / index.php from the

'Results page' a few seconds After Submitting?

If so, where in the script / file would I put the redirect?

Thanks...

:)

FirstBorn

PS.  Thanks for your patience with me... :)
try adding

AddHandler application/x-httpd-php .php .html

to your .htaccess

if you want to display dynamic content (the submitted fields from the form) onto an html (static content) page, you will need to have php parse html files as well

cheers,

loz
Hi loz,

I've added an .htaccess file in the specific directory needed for this to work.

The file consists of the line of code you mentioned above.

CHMODed to 664.

Attempted to load the index.html file, and it loaded, but with extra code displayed on the actual page.

I entered information, clicked submit and get "HTTP 404 - File not found"

Renamed the file to index.php, This Time, It Stays the Same...  NOTHING Works with this file, now.

I moved the .htaccess file, then retried the index.php, refreshed the page, and I get:

"No information sent to script" on the top of the page (just like the 'else' statment in the script).

So, the .htaccess thing doesn't work.

Is there a way to just Redirect BACK to the index.html file after getting the results page?  

This seems to be the ONLY Solution if I can't just eliminate the text input boxes after

user has submitted the information replaced with a message letting the user know

that they've had their information submitted and a Thank You.

Thanks.

:)

FirstBorn

probably there is a way using javascript, but that's avoiding the problem not solving it. to help me, can you do view source on the form and paste the result in here?

cheers,

loz
Hi loz,

Here are the results from using index.php

Thanks...

:)

FirstBorn

---------------------------------------------------------
<HTML>
 
 <HEAD>
  <TITLE>Test Page
    </TITLE>
 </HEAD>
 <BODY>
No information sent to script
<table width="100%" border="0" cellpadding="0">
  <tr>
    <td width="20%" valign="top"><table cellpadding="0"

cellspacing="0" border="0" height="100%">
        <tr>
          <td><div align="center"><font face="Verdana, Arial,

Helvetica, sans-serif" color="#000000" size="5">&nbsp;Title
              </font></div></td>
        </tr>
        <tr>
          <td><img src="/_blnk.gif" width="150" height="5"></td>
        </tr>
        <tr>
          <td width="169" height="100%" valign="top"

style="padding-top:10px;padding-bottom:10px;padding-left:10px;">
            <table width="95%" border="0" cellpadding="10">
              <tr>
                <td><div align="center"></div></td>
              </tr>
<tr>
                <td><div align="center"><font size="2" face="Verdana,

Arial, Helvetica, sans-serif">My Page
</div></td>
              </tr>
              <tr>
                <td><div align="center"><a href="link1.html"><font

size="2" face="Verdana, Arial, Helvetica,

sans-serif">link1</font></a></div><BR>
<BR>



<div align="center"><a href="link2"><font size="2" face="Verdana,

Arial, Helvetica, sans-serif">Link 2</font></a></div></td>
</td>
<TR>
<TD>
<BR>
<BR>
<BR>

<div align="center"><B>This is what I need to Work, Thanks! ... :)
</B>
<font size="2" face="Verdana, Arial, Helvetica, sans-serif">
</TD>
</TR>

</font>
</div></td>

</tr>




</font></a></div></td>
</tr>
 

             </tr>

            </table>
</td>
        </tr>
        <tr>
          <td>&nbsp;</td>
        </tr>
      </table></td>
    <td width="80%" valign="top"><p><a name="top"></a></p>
      <table width="95%" border="0" align="center" cellpadding="10">
        <tr>
          <td valign="top"><table width="100%" border="1"

align="center" cellpadding="10">

   <TABLE>
<TR>

<TR>
     <TD>
<hr width="100%" align=center>

    <FONT FACE="Times" SIZE="5"><B>Title</B><BR></FONT>
<hr width="100%" align=center>

</TD>
     
</TR>
</TABLE>
<CENTER><FONT FACE="Times" SIZE="8" COLOR="#FF0000"><B>    

</B></FONT></CENTER>
   <FONT FACE="Times New Roman" SIZE="3">
<P>


<table  width="90%" border="0" cellspacing="0" cellpadding="0">
     <tr>
          <!-- Row 1 Column 1 -->
          <td  align="left">
               
<table  width="90%" border="1" cellspacing="0" cellpadding="5">
     <tr>
          <!-- Row 1 Column 1 -->
          <td  align="left">
               <div align='Left'>Please, kick off your

shoes, relax, and</div>
<div>Enjoy the articles included in the links below</div>
<P>This Archive was made JUST FOR YOU!</P>
<P>_</P>

<Div><A HREF="link3.html">Link3</A></Div>



<P>_</P>
</td>
     </tr>
</table>
          </td>
     </tr>
</table>

<br>
<br>
<hr width="100%" align=center>

    <FONT FACE="Times" SIZE="5"><B>More Links</B><BR></FONT>
<hr width="100%" align=center>
<P><A HREF="Link4.html">Link4</A></P>
<P><A HREF="Link5.html">Link5</A></P>
<P><A HREF="Link6.html">Link6</A></P>


</BODY>
</HTML>
----------------------------
Here are the Results (below) using index.html (same file, different extension)
-----------------------------------------------------------------------
Before Submit:
------------------------
<HTML>
 
 <HEAD>
  <TITLE>Test Page
    </TITLE>
 </HEAD>
 <BODY>
<?php
if($_POST["submit"]) {

// Load up from POST
$name=$_POST['name'];
$email=$_POST['email'];
$altsubject=$_POST['altsubject'];
$allinfo=$_POST['comments'];

$allinfo=nl2br($allinfo);

// Build message parts
//$recipient = "me@me.com";
$recipient = "me@email.com";
$subject = "Here's My Subject";
$message = "Name: $name\nEmail: $email\nAltSubject:

$altsubject\ncomments:" . $_POST["comments"] . "\n";
$from = "$email";

// Send mail
mail($recipient,$subject,$message,$from,$altsubject);
} else {
  print "No information sent to script";
}
?>

<table width="100%" border="0" cellpadding="0">
  <tr>
    <td width="20%" valign="top"><table cellpadding="0"

cellspacing="0" border="0" height="100%">
        <tr>
          <td><div align="center"><font face="Verdana, Arial,

Helvetica, sans-serif" color="#000000" size="5">&nbsp;Title
              </font></div></td>
        </tr>
        <tr>
          <td><img src="/_blnk.gif" width="150" height="5"></td>
        </tr>
        <tr>
          <td width="169" height="100%" valign="top"

style="padding-top:10px;padding-bottom:10px;padding-left:10px;">
            <table width="95%" border="0" cellpadding="10">
              <tr>
                <td><div align="center"></div></td>
              </tr>
<tr>
                <td><div align="center"><font size="2" face="Verdana,

Arial, Helvetica, sans-serif">My Page
</div></td>
              </tr>
              <tr>
                <td><div align="center"><a href="link1.html"><font

size="2" face="Verdana, Arial, Helvetica,

sans-serif">link1</font></a></div><BR>
<BR>



<div align="center"><a href="link2"><font size="2" face="Verdana,

Arial, Helvetica, sans-serif">Link 2</font></a></div></td>
</td>
<TR>
<TD>
<BR>
<BR>
<BR>

<div align="center"><B>This is what I need to Work, Thanks! ... :)
</B>
<font size="2" face="Verdana, Arial, Helvetica, sans-serif">
<?php
if($_POST["submit"]) {
?>
<font size="2" face="Verdana, Arial, Helvetica, sans-serif">
<div align=left><B>Name</B></div>
<?php print $name; ?>
<div align=left><B>E-mail</B></div>
<?php print $email; ?>
<div align=left><B>Subject</B></div>
<?php print $altsubject; ?>
<div align=left><B>Comments</B></div>
<?php print $allinfo; ?>
} else {
?>
<form action="<?php print $_SERVER["PHP_SELF"]; ?>" method="post">
<div align=left><B>Name</B></div>
<input type="text" name="name" size="20" maxlength="100">
<div align=left><B>E-mail</B></div>
<input type="text" name="email" size="20" maxlength="100">
<div align=left><B>Subject</B></div>
<input type="text" name="altsubject" size="20" maxlength="100">
<div align=left><B>Comments</B></div>
<textarea wrap=phyiscal rows="12" name="comments" cols="15" ></textarea>
<BR>
<input type="hidden" name="submit" value="Submit">
<input type="submit" name="submit" value="Submit">
<input type="reset">
<BR>
</form>
<?php } ?>
</TD>
</TR>

</font>
</div></td>

</tr>




</font></a></div></td>
</tr>
 

             </tr>

            </table>
</td>
        </tr>
        <tr>
          <td>&nbsp;</td>
        </tr>
      </table></td>
    <td width="80%" valign="top"><p><a name="top"></a></p>
      <table width="95%" border="0" align="center" cellpadding="10">
        <tr>
          <td valign="top"><table width="100%" border="1"

align="center" cellpadding="10">

   <TABLE>
<TR>

<TR>
     <TD>
<hr width="100%" align=center>

    <FONT FACE="Times" SIZE="5"><B>Title</B><BR></FONT>
<hr width="100%" align=center>

</TD>
     
</TR>
</TABLE>
<CENTER><FONT FACE="Times" SIZE="8" COLOR="#FF0000"><B>    

</B></FONT></CENTER>
   <FONT FACE="Times New Roman" SIZE="3">
<P>


<table  width="90%" border="0" cellspacing="0" cellpadding="0">
     <tr>
          <!-- Row 1 Column 1 -->
          <td  align="left">
               
<table  width="90%" border="1" cellspacing="0" cellpadding="5">
     <tr>
          <!-- Row 1 Column 1 -->
          <td  align="left">
               <div align='Left'>Please, kick off your

shoes, relax, and</div>
<div>Enjoy the articles included in the links below</div>
<P>This Archive was made JUST FOR YOU!</P>
<P>_</P>

<Div><A HREF="link3.html">Link3</A></Div>



<P>_</P>
</td>
     </tr>
</table>
          </td>
     </tr>
</table>

<br>
<br>
<hr width="100%" align=center>

    <FONT FACE="Times" SIZE="5"><B>More Links</B><BR></FONT>
<hr width="100%" align=center>
<P><A HREF="Link4.html">Link4</A></P>
<P><A HREF="Link5.html">Link5</A></P>
<P><A HREF="Link6.html">Link6</A></P>


</BODY>
</HTML>
----------------------
After Submit:
---------------------
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<html>

<head>
<style>
a:link                  {font:8pt/11pt verdana; color:red}
a:visited            {font:8pt/11pt verdana; color:#4e4e4e}
</style>
<meta HTTP-EQUIV="Content-Type" Content="text-html; charset=Windows-1252">
<title>HTTP 404 Not Found</title>
</head>
<script>

function Homepage(){
// in real bits, urls get returned to our script like this:
// res://shdocvw.dll/http_404.htm#http://www.DocURL.com/bar.htm

      //For testing use DocURL = "res://shdocvw.dll/http_404.htm#https://www.microsoft.com/bar.htm"
      DocURL = document.location.href;
            
      //this is where the http or https will be, as found by searching for :// but skipping the res://
      protocolIndex=DocURL.indexOf("://",4);
      
      //this finds the ending slash for the domain server
      serverIndex=DocURL.indexOf("/",protocolIndex + 3);

            //for the href, we need a valid URL to the domain. We search for the # symbol to find the begining
      //of the true URL, and add 1 to skip it - this is the BeginURL value. We use serverIndex as the end marker.
      //urlresult=DocURL.substring(protocolIndex - 4,serverIndex);
      BeginURL=DocURL.indexOf("#",1) + 1;
      if (protocolIndex - BeginURL > 7)
            urlresult=""
      
      urlresult=DocURL.substring(BeginURL,serverIndex);

      //for display, we need to skip after http://, and go to the next slash
      displayresult=DocURL.substring(protocolIndex + 3 ,serverIndex);

      // Security precaution: must filter out "urlResult" and "displayresult"
      forbiddenChars = new RegExp("[<>\'\"]", "g");      // Global search/replace
      urlresult = urlresult.replace(forbiddenChars, "");
      displayresult = displayresult.replace(forbiddenChars, "");

      document.write('<A target=_top HREF="' + urlresult + '">' + displayresult + "</a>");

}
function doSearch()
{
    saOC.NavigateToDefaultSearch();
}

function initPage()
{
    document.body.insertAdjacentHTML("afterBegin","<object id=saOC CLASSID='clsid:B45FF030-4447-11D2-85DE-00C04FA35C89' HEIGHT=0 width=0></object>");
}

</script>


<body bgcolor="white" onload="initPage()">

<table width="400" cellpadding="3" cellspacing="5">
  <tr>
    <td id="tableProps" valign="top" align="left"><img id="pagerrorImg" SRC="pagerror.gif"
    width="25" height="33"></td>
    <td id="tableProps2" align="left" valign="middle" width="360"><h1 id="errortype"
    style="COLOR: black; FONT: 13pt/15pt verdana"><span id="errorText">The page cannot be found</span></h1>
    </td>
  </tr>
  <tr>
    <td id="tablePropsWidth" width="400" colspan="2"><font
    style="COLOR: black; FONT: 8pt/11pt verdana">The page you are looking for might have been
    removed, had its name changed, or is temporarily unavailable.</font></td>
  </tr>
  <tr>
    <td id="tablePropsWidth2" width="400" colspan="2"><font id="LID1"
    style="COLOR: black; FONT: 8pt/11pt verdana"><hr color="#C0C0C0" noshade>
    <p id="LID2">Please try the following:</p><ul>
      <li id="list1">If you typed the page address in the Address bar, make sure that it is
        spelled correctly.<br>
      </li>
      <li id="list2">Open the <script> Homepage(); </script> home page, and then look for links to the information
        you want. </li>
      <li id="list3">Click the <a href="javascript:history.back(1)"><img valign=bottom border=0 src="back.gif"> Back</a> button to try another link. </li>    
      <li ID="list4">Click <a href="javascript:doSearch()"><img border=0 src="search.gif" width="16" height="16" alt="search.gif (114 bytes)" align="center"> Search</a> to look for information on the Internet. </li>
</ul>
    <p><br>
    </p>
    <h2 id="ietext" style="font:8pt/11pt verdana; color:black">HTTP 404 - File not found<br>
    Internet Explorer <BR>
    </h2>
    </font></td>

  </tr>
</table>
</body>
</html>
-------------------------------------------------
hi,

alright thanks for that - you really need to get html parsed as php if you're determined to have the index.html parsed. is it possible to get in touch with your server admin and get them to change the httpd.conf to allow html to be parsed? AddType application/x-httpd-php .html i think

loz
Hi loz,

I think I found one reason why it's not working.  I don't know how to fix it, though.

When I click "Submit", it goes to this URL for the 404 Not Found Error:

http://www.myurl.com/test/<?name=First+Last&email=me@email.com&altsubject=Test+Subject&comments=Test+Comments+Go+Here%21%0D%0A%0D%0AAnd+some+More%21%21%21&submit=Submit&submit=Submit

INSTEAD OF:  http://www.myurl.com/test/

Can this be the problem? and if so, how can it be fixed?
------------

Also, Even if I use the .php file (named .php instead of .html,) it will Not Load the Text Input Boxes with Your Newer Script.  It will load with the "No information sent to script" and I don't Need ANY Thing sent to the script UNTIL The User Submits the Information.

Thanks...

:)

FirstBorn
nope that's not the problem, it just needs the form action set correctly (i.e. hard coded rather than action="<?php print $_SERVER["PHP_SELF"]; ?>"

in index.php, change } else {
  print "No information sent to script";
}

to:

}

and if there are more problems, give me your current code listing from the file

cheers,

loz
Hi loz,

k, Here's the Source Code of when it loads.  

When it loads, it doesn't have Any Text Input Boxes.

That Section Still Remains Blank.

(no Input Text Boxes and no Submit buttons)

Thanks...

:)

FirstBorn

---------------------------------
<HTML>
 
 <HEAD>
  <TITLE>Test Page
    </TITLE>
 </HEAD>
 <BODY>

<table width="100%" border="0" cellpadding="0">
  <tr>
    <td width="20%" valign="top"><table cellpadding="0"

cellspacing="0" border="0" height="100%">
        <tr>
          <td><div align="center"><font face="Verdana, Arial,

Helvetica, sans-serif" color="#000000" size="5">&nbsp;Title
              </font></div></td>
        </tr>
        <tr>
          <td><img src="/_blnk.gif" width="150" height="5"></td>
        </tr>
        <tr>
          <td width="169" height="100%" valign="top"

style="padding-top:10px;padding-bottom:10px;padding-left:10px;">
            <table width="95%" border="0" cellpadding="10">
              <tr>
                <td><div align="center"></div></td>
              </tr>
<tr>
                <td><div align="center"><font size="2" face="Verdana,

Arial, Helvetica, sans-serif">My Page
</div></td>
              </tr>
              <tr>
                <td><div align="center"><a href="link1.html"><font

size="2" face="Verdana, Arial, Helvetica,

sans-serif">link1</font></a></div><BR>
<BR>



<div align="center"><a href="link2"><font size="2" face="Verdana,

Arial, Helvetica, sans-serif">Link 2</font></a></div></td>
</td>
<TR>
<TD>
<BR>
<BR>
<BR>

<div align="center"><B>This is what I need to Work, Thanks! ... :)
</B>
<font size="2" face="Verdana, Arial, Helvetica, sans-serif">
</TD>
</TR>

</font>
</div></td>

</tr>




</font></a></div></td>
</tr>
 

             </tr>

            </table>
</td>
        </tr>
        <tr>
          <td>&nbsp;</td>
        </tr>
      </table></td>
    <td width="80%" valign="top"><p><a name="top"></a></p>
      <table width="95%" border="0" align="center" cellpadding="10">
        <tr>
          <td valign="top"><table width="100%" border="1"

align="center" cellpadding="10">

   <TABLE>
<TR>

<TR>
     <TD>
<hr width="100%" align=center>

    <FONT FACE="Times" SIZE="5"><B>Title</B><BR></FONT>
<hr width="100%" align=center>

</TD>
     
</TR>
</TABLE>
<CENTER><FONT FACE="Times" SIZE="8" COLOR="#FF0000"><B>    

</B></FONT></CENTER>
   <FONT FACE="Times New Roman" SIZE="3">
<P>


<table  width="90%" border="0" cellspacing="0" cellpadding="0">
     <tr>
          <!-- Row 1 Column 1 -->
          <td  align="left">
               
<table  width="90%" border="1" cellspacing="0" cellpadding="5">
     <tr>
          <!-- Row 1 Column 1 -->
          <td  align="left">
               <div align='Left'>Please, kick off your

shoes, relax, and</div>
<div>Enjoy the articles included in the links below</div>
<P>This Archive was made JUST FOR YOU!</P>
<P>_</P>

<Div><A HREF="link3.html">Link3</A></Div>



<P>_</P>
</td>
     </tr>
</table>
          </td>
     </tr>
</table>

<br>
<br>
<hr width="100%" align=center>

    <FONT FACE="Times" SIZE="5"><B>More Links</B><BR></FONT>
<hr width="100%" align=center>
<P><A HREF="Link4.html">Link4</A></P>
<P><A HREF="Link5.html">Link5</A></P>
<P><A HREF="Link6.html">Link6</A></P>


</BODY>
</HTML>
can i see the php source i mean (i.e. the raw file before being processed)

loz
Sure...
(I modified contact info as to keep privacy...)

Thanks...

:)
-------------

<HTML>
 
 <HEAD>
  <TITLE>Test Page
    </TITLE>
 </HEAD>
 <BODY>
<?php
if($_POST["submit"]) {

// Load up from POST
$name=$_POST['name'];
$email=$_POST['email'];
$altsubject=$_POST['altsubject'];
$allinfo=$_POST['comments'];

$allinfo=nl2br($allinfo);

// Build message parts
//$recipient = "me@me.com";
$recipient = "me@me.com";
$subject = "Here's My Subject";
$message = "Name: $name\nEmail: $email\nAltSubject:

$altsubject\ncomments:" . $_POST["comments"] . "\n";
$from = "$email";

// Send mail
mail($recipient,$subject,$message,$from,$altsubject);
}
?>

<table width="100%" border="0" cellpadding="0">
  <tr>
    <td width="20%" valign="top"><table cellpadding="0"

cellspacing="0" border="0" height="100%">
        <tr>
          <td><div align="center"><font face="Verdana, Arial,

Helvetica, sans-serif" color="#000000" size="5">&nbsp;Title
              </font></div></td>
        </tr>
        <tr>
          <td><img src="/_blnk.gif" width="150" height="5"></td>
        </tr>
        <tr>
          <td width="169" height="100%" valign="top"

style="padding-top:10px;padding-bottom:10px;padding-left:10px;">
            <table width="95%" border="0" cellpadding="10">
              <tr>
                <td><div align="center"></div></td>
              </tr>
<tr>
                <td><div align="center"><font size="2" face="Verdana,

Arial, Helvetica, sans-serif">My Page
</div></td>
              </tr>
              <tr>
                <td><div align="center"><a href="link1.html"><font

size="2" face="Verdana, Arial, Helvetica,

sans-serif">link1</font></a></div><BR>
<BR>



<div align="center"><a href="link2"><font size="2" face="Verdana,

Arial, Helvetica, sans-serif">Link 2</font></a></div></td>
</td>
<TR>
<TD>
<BR>
<BR>
<BR>

<div align="center"><B>This is what I need to Work, Thanks! ... :)
</B>
<font size="2" face="Verdana, Arial, Helvetica, sans-serif">
<?php
if($_POST["submit"]) {
?>
<font size="2" face="Verdana, Arial, Helvetica, sans-serif">
<div align=left><B>Name</B></div>
<?php print $name; ?>
<div align=left><B>E-mail</B></div>
<?php print $email; ?>
<div align=left><B>Subject</B></div>
<?php print $altsubject; ?>
<div align=left><B>Comments</B></div>
<?php print $allinfo; ?>
} else {
?>
<form action="<?php print $_SERVER["PHP_SELF"]; ?>" method="post">
<div align=left><B>Name</B></div>
<input type="text" name="name" size="20" maxlength="100">
<div align=left><B>E-mail</B></div>
<input type="text" name="email" size="20" maxlength="100">
<div align=left><B>Subject</B></div>
<input type="text" name="altsubject" size="20" maxlength="100">
<div align=left><B>Comments</B></div>
<textarea wrap=phyiscal rows="12" name="comments" cols="15" ></textarea>
<BR>
<input type="hidden" name="submit" value="Submit">
<input type="submit" name="submit" value="Submit">
<input type="reset">
<BR>
</form>
<?php } ?>
</TD>
</TR>

</font>
</div></td>

</tr>




</font></a></div></td>
</tr>
 

             </tr>

            </table>
</td>
        </tr>
        <tr>
          <td>&nbsp;</td>
        </tr>
      </table></td>
    <td width="80%" valign="top"><p><a name="top"></a></p>
      <table width="95%" border="0" align="center" cellpadding="10">
        <tr>
          <td valign="top"><table width="100%" border="1"

align="center" cellpadding="10">

   <TABLE>
<TR>

<TR>
     <TD>
<hr width="100%" align=center>

    <FONT FACE="Times" SIZE="5"><B>Title</B><BR></FONT>
<hr width="100%" align=center>

</TD>
     
</TR>
</TABLE>
<CENTER><FONT FACE="Times" SIZE="8" COLOR="#FF0000"><B>    

</B></FONT></CENTER>
   <FONT FACE="Times New Roman" SIZE="3">
<P>


<table  width="90%" border="0" cellspacing="0" cellpadding="0">
     <tr>
          <!-- Row 1 Column 1 -->
          <td  align="left">
               
<table  width="90%" border="1" cellspacing="0" cellpadding="5">
     <tr>
          <!-- Row 1 Column 1 -->
          <td  align="left">
               <div align='Left'>Please, kick off your

shoes, relax, and</div>
<div>Enjoy the articles included in the links below</div>
<P>This Archive was made JUST FOR YOU!</P>
<P>_</P>

<Div><A HREF="link3.html">Link3</A></Div>



<P>_</P>
</td>
     </tr>
</table>
          </td>
     </tr>
</table>

<br>
<br>
<hr width="100%" align=center>

    <FONT FACE="Times" SIZE="5"><B>More Links</B><BR></FONT>
<hr width="100%" align=center>
<P><A HREF="Link4.html">Link4</A></P>
<P><A HREF="Link5.html">Link5</A></P>
<P><A HREF="Link6.html">Link6</A></P>


</BODY>
</HTML>
ASKER CERTIFIED SOLUTION
Avatar of lozloz
lozloz

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Hi loz,

Thanks!

This Worked!!!

:)

FirstBorn