Jump to content

Archived

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

izzy

Simple data entry form

Recommended Posts

I'm trying to make a very simple form that places information in my database.
I used a part of an existing script i have made some time ago.

All i'm getting is a blanc page once i submit the form.

Can someone tell me what is going wrong?
Here is the code from the different scripts.

This is the form:

<html>
<head>
<title>Add a link or banner to the directory</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link rel="stylesheet" href="hotbabevote.css" type="text/css">
</head>

<body bgcolor="#FFFFFF" text="#000000" class="stdheaderconfig"><p><br>
<p><br>
  <span class="infosmallconfig">Use this form to add you link/banner to the directory. </span></p>
<form action=entry.php method=post enctype="multipart/form-data">
  <table width="700" border="0" cellspacing="2" cellpadding="2">
    <tr valign="middle" bgcolor="F9F9F9">
      <td class="stdtextconfig" width="122">Last Name:</td>
      <td width="564">
        <input type="text" name="lastname" size="45">
      </td>
    </tr>
    <tr valign="middle" bgcolor="F9F9F9">
      <td class="stdtextconfig" width="122">First Name:</td>
      <td width="564">
        <input type="text" name="firstname" size="45">
      </td>
    </tr>
    <tr valign="middle" bgcolor="F9F9F9">
      <td class="stdtextconfig" width="122">Company Name:</td>
      <td width="564">
        <input type="text" name="company" size="45">
      </td>
    </tr>
    <tr valign="middle" bgcolor="F9F9F9">
      <td class="stdtextconfig" width="122">Company URL:</td>
      <td width="564">
        <input type="text" name="companyurl" size="45"><br>
        (ie.  http://www.myfashionshop.com )
      </td>
    </tr>
    <tr valign="middle" bgcolor="F9F9F9">
      <td class="stdtextconfig" width="122">Business Description:</td>
      <td width="564">
        <input type="text" name="description" size="45">
      </td>
    </tr>
    <tr valign="middle" bgcolor="F9F9F9">
      <td class="stdtextconfig" width="122">Country:</td>
      <td width="564">
        <input type="text" name="country" size="45">
      </td>
    </tr>
    <tr valign="middle" bgcolor="F9F9F9">
      <td class="stdtextconfig" width="122">City/State:</td>
      <td width="564">
        <input type="text" name="city" size="45">
      </td>
    </tr>
    <tr valign="middle" bgcolor="F9F9F9">
      <td class="stdtextconfig" width="122">Sales Rep. Name:</td>
      <td width="564">
        <input type="text" name="repname" size="45">
      </td>
    </tr>
    <tr valign="middle" bgcolor="F9F9F9">
      <td class="stdtextconfig" width="122">Banner upload:</td>
      <td class="stdtextconfig" width="564">
        <input type="file" name="fotopath">
      </td>
    </tr>
    <tr bgcolor="F9F9F9">
      <td colspan="2">
        <div align="center">
          <input type="hidden" name="action" value="insert">
          <input type="submit" name="Submit" value="OK">
        </div>
      </td>
    </tr>
  </table>
</form>
<p>&nbsp; </p>
</body>
</html>


here is the script that is supposed to enter the info into the database:

//Een verbinding met de database maken
include("system/connect.inc.php");

//parameters lezen
if(isset($_GET['action'])) $action=$_GET['action'];
if(isset($_POST['action'])) $action=$_POST['action'];


if(isset($_REQUEST['action'])) $action=$_REQUEST['action'];

//Hier worden nieuwe huizen toegevoegd
if($action=="insert"){
//parameters lezen
$last_name=$_POST['lastname'];
$first_name=$_POST['firstname'];
$company_name=$_POST['company'];
$company_url=$_POST['companyurl'];
$link_description=$_POST['description'];
$link_country=$_POST['country'];
$link_city=$_POST['city'];
$rep_name=$_POST['repname'];

if($_FILES['fotopath']['size']>0){
//Eventueel nieuwe afbeelding uploaden
$source=$_FILES['fotopath']['tmp_name'];
$afbeeldingnaam=time() . $_FILES['fotopath']['name'];
//URL samenstellen
$dest="banners/" . $afbeeldingnaam;
$check1=copy($source,$dest);
}

$link_SQL_insert="INSERT INTO linkdir (lastname,firstname,company,companyurl,description,country,city,repname,fotopath) VALUES ('$last_name','$first_name','$company_name','$company_url','$link_description','$link_country','$link_city','$rep_name','$afbeeldingnaam')";
}



Here is the page that is supposed to show the records.

//Een verbinding met de database maken
include("system/connect.inc.php");

$link_SQL="SELECT * FROM linkdir ORDER BY firstname";
$link_result=mysql_query($link_SQL);

//In dit deel worden de gegevens weergegeven
while($link=mysql_fetch_array($link_result)){
//afbeelding voorbereiden
$img="";
if($link['fotopath']) $img="<img width=150 height=150 src='../banners/" . $link['fotopath'] . "'>";

?>

<table width="410" border="0">
<tr>
<td width="100">Last Name: </td>
  <td>
    <span><?php echo $link['firstname']?></span>
  </td>
</tr>
<tr>
<td width="100">First Name: </td>
  <td>
    <span><?php echo $link['firstname']?></span>
  </td>
</tr>
<tr>
<td>Company: </td>
  <td>
    <span><?php echo $link['company']?></span>
  </td>
</tr>
<tr>
<td>Company URL: </td>
  <td>
    <span><?php echo $link['companyurl']?></span>
  </td>
</tr>
<tr>
<td>Description: </td>
  <td>
    <span><?php echo $link['description']?></span>
  </td>
</tr>
<tr>
<td>Country: </td>
  <td>
    <span><?php echo $link['country']?></span>
  </td>
</tr>
<tr>
<td>City/State: </td>
  <td>
    <span><?php echo $link['city']?></span>
  </td>
</tr>
<tr>
<td>Rep. Name: </td>
  <td>
    <span><?php echo $link['repname']?></span>
  </td>
</tr>
      </table>
    <td width="200">   
      <span><?php echo $img?></span>
  </td>
</table>
<p><p></p></p>
<?php
}
mysql_close
?>

Help me please, This is supposed to be simple... :-(

Share this post


Link to post
Share on other sites
method="post" action=" " ect .................


" "<<<<<<<<<<where the in the form.

Share this post


Link to post
Share on other sites
Your missing " " on your form opening .
[code]
<form action=entry.php method=post enctype="multipart/form-data">
  <table width="700" border="0" cellspacing="2" cellpadding="2">
[/code]
sould be

[code]
<form action="entry.php" method="post" enctype="multipart/form-data">
  <table width="700" border="0" cellspacing="2" cellpadding="2">
[/code]
Remmber if you use post without caps lock remmber to use it without in you php tags. or anywhere else.

Share this post


Link to post
Share on other sites
once more thinks
[code]
if(isset($_GET['action'])) $action=$_GET['action'];
if(isset($_POST['action'])) $action=$_POST['action'];
[/code]

use $_GET/$_POST - in lower case since you use it as small case on your form
like this
$_get/$_post . or
go to your form begining and in method  change it to method="POST" not method="post"

Share this post


Link to post
Share on other sites
Thanks
But still nothing has changed.

I keep looking over the scripts but i can't see the problem  ??? >:(

HELP !!!

Share this post


Link to post
Share on other sites
Sorry everyone...

Database connection wasn't good...

:-[

Share this post


Link to post
Share on other sites

×

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.