Jump to content

Guestbook problem


erikla

Recommended Posts

Dear phpfreak users

 

It is several years ago I looked at php code, so I am very rusty here. Many years ago I managed (with some help) to produce a guestbook for my website. It is the only part containing php code. A week ago I changed webhotel and after transferring my website to the new Webhotel, something is not working properly. I have been trying to pinpoint what it is. I think I have found one issue: When a user fill out a form and press the submit button, the variables are not transferred to the php page, which is written in the action part of the form. To make it less confusing I have deleted parts of my php page and just kept the part, where I guess there is a problem.

 

 

The form page named guest_form.html:

 

<HTML>
<HEAD>
<TITLE>Add items to the Guest book</TITLE>

<LINK REL=stylesheet TYPE="text/css" HREF="generel/hoved.css">


</HEAD>
<BODY>

<h1><font color="#903C39">Guestbook</font></h1>
<FORM method="POST" action="guest_save.php">

    
    <hr><br>
<table cellspacing=5 cellpadding=5>

<tr>
<td valign=top><strong><p><b><font color="#903C39">Name</font></b></p></strong></td>
<td valign=top>
<INPUT type="text" name="navn" size=40 maxlength=60>
</td>

</tr>

<tr>
<td valign=top><strong><p><b><font color="#903C39">E-mail</font></b></p></strong></td>
<td valign=top>
<INPUT type="text" name="epost" size=40 maxlength=60>
</td>
</tr>

<tr>
<td valign=top><strong><p><b><font color="#903C39">Contribution</font></b></p></strong></td>
<td valign=top>
<TEXTAREA name="indlaeg" cols=50 rows=6></TEXTAREA>
</td>
</tr>


<tr>
<td align=center colspan=2>
<INPUT type="submit" value="Submit Contribution">
</td>
</tr>

</table>
</FORM>


</BODY>
</HTML>
 

 

The guest_save.php page:

 

<?php

if ($navn == "") {echo "Name is empty";}
if ($navn != "") {echo "Name is not empty";}
                                  

?>

 

 

Comments:

 

I uploaded both pages and they are located at the same level. Then I filled out the form and pressed the submit button. The php page was displayed with the text: "Name is empty". So it look like the content of 'navn' is not tranferred to the php page. Is my code wrong could it be a problem at the Webhotel? I really hope somebody can push me in the right direction ...

 

Regards,

 

Erik

 

Link to comment
https://forums.phpfreaks.com/topic/288224-guestbook-problem/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.