Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Jul 12th, 2005, 9:56 AM   #1
bulio
Hobbyist Programmer
 
bulio's Avatar
 
Join Date: Jul 2004
Location: Location
Posts: 138
Rep Power: 5 bulio is on a distinguished road
Form Code problem

Hi everyone,

I've written up the basic code for my get.php script, but it doesn't seem to be working. I keep getting error: undefined index in all the lines that $_POST is on. What could be wrong?

HTML code:

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

<HTML>
<HEAD>
     <TITLE>Coyote Product Submit Form</TITLE>
</HEAD>

<BODY>
     <H3 ALIGN="center">Coyote website product submit form</H3>

     <FORM ACTION="get.php" METHOD="post" ENCTYPE="text/plain">
           <TABLE>
               <TR>
                    <TD>&nbsp;&nbsp;<B>Location of product:</B>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <INPUT NAME="Productl" TYPE="text" SIZE="20">
                    <BR>
                    <BR>
                    &nbsp;&nbsp;<B>Description:</B>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <INPUT NAME="Description" TYPE="text" SIZE="20">
                    <BR>
                    <BR>
                    &nbsp;&nbsp;<B>Make:</B>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <INPUT NAME="Make" TYPE="text" SIZE="20">
                    <BR>
                    <BR>
                    &nbsp;&nbsp;<B>Model:</B>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <INPUT NAME="Model" TYPE="text" SIZE="20">
                    <BR>
                    <BR>
                    &nbsp;&nbsp;<B>Year:</B>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <INPUT NAME="Year" TYPE="text" SIZE="20">
                    <BR>
                    <BR>
                    &nbsp;&nbsp;<B>Color:</B>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <INPUT NAME="Color" TYPE="text" SIZE="20">
                    <BR>
                    <BR>
                    &nbsp;&nbsp;<B>Suggested list price:</B>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <INPUT NAME="Suggested list price" TYPE="text" VALUE="$0.00" SIZE="15">
                    <BR>
                    <BR>
                    &nbsp;&nbsp;<B>Inventory Type:</B>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <INPUT NAME="Inventory Type" TYPE="text" VALUE="Container, Truck, Reefer etc." SIZE="24">
                    <BR>
                    <BR>
                    &nbsp;&nbsp;<B>Serial #:</B>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <INPUT NAME="Serial #" TYPE="text" VALUE="#" SIZE="30">
                    <BR>
                    <BR>
                    &nbsp;&nbsp;<B>Name of submitter:</B>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <INPUT NAME="Full name" TYPE="text" SIZE="20"></TD>
               </TR>

               <TR>
                    <TD ALIGN="center"><INPUT TYPE="submit" VALUE="Submit" STYLE="color: #ffffff; background-color: #000000"></TD>
               </TR>
          </TABLE>
     </FORM><A HREF="index.htm">Click Here</A> to submit another product to the site.
     <BR>
     <BR>
     <BR>
      

     <H3 ALIGN="center">Instructions</H3>
     <BR>
     <BR>

     <H5>1: Enter all required information into the text box. Avoid leaving blank spaces.
     <BR>
     <BR>
     2: Once you are completed, press the 'Submit' button. This will then open your e-mail client. Now you should see some text already already in the email.
     <BR>
     <BR>
     3: Now, add an attachment to the email. The attachment should be picture of the object that you want to sell.
     <BR>
     <BR>
     4: Send The email. (It will automatically be sent to the appropriate address)
     <BR>
     <BR>
     5: If you need assistance understanding the text boxes, please visit <A HREF="submit_help.htm">This Page</A>
     <BR>
     <BR>
     6: The information will soon be added to the site.</H5>
     <BR>
</BODY>
</HTML>

get.php

<?php
//Start of the PHP script
$ProductL = $_POST["Productl"]; //Gets all the variables
$Desc = $_POST['Description'];
$Make $_POST['Make'];
$Model = $_POST['Model'];
$Year = $_POST['Year'];
//Echo to the user
echo "<BR /><b>Product Location:</b>$ProdductL";
echo "<BR /><b>Description:</b>$Desc";
?>
bulio is offline   Reply With Quote
Old Jul 12th, 2005, 10:14 AM   #2
skuinders
Hobbyist Programmer
 
skuinders's Avatar
 
Join Date: Jun 2005
Location: MA, US
Posts: 204
Rep Power: 4 skuinders is on a distinguished road
$Make $_POST['Make']; // missing an = sign
__________________
"A stupid man's report of what a clever man says can never be accurate, because he unconciously translates what he hears into something he can understand."
- B. Russell

http://web.bryant.edu/~srk2
skuinders is offline   Reply With Quote
Old Jul 12th, 2005, 10:22 AM   #3
tempest
Programming Guru
 
tempest's Avatar
 
Join Date: Oct 2004
Posts: 1,041
Rep Power: 5 tempest is on a distinguished road
Send a message via ICQ to tempest Send a message via AIM to tempest Send a message via Yahoo to tempest
get.php
<?php
if(count($_POST) > 0) {
//Start of the PHP script
$ProductL = $_POST["Productl"]; //Gets all the variables
$Desc = $_POST['Description'];
$Make $_POST['Make'];
$Model = $_POST['Model'];
$Year = $_POST['Year'];
//Echo to the user
echo "<BR /><b>Product Location:</b>$ProdductL";
echo "<BR /><b>Description:</b>$Desc";
} else {
    echo "Failure or something";
}
?>
__________________

tempest is offline   Reply With Quote
Old Jul 12th, 2005, 12:36 PM   #4
bulio
Hobbyist Programmer
 
bulio's Avatar
 
Join Date: Jul 2004
Location: Location
Posts: 138
Rep Power: 5 bulio is on a distinguished road
Tempest, I tried your code and it constantly outputs the failure message. Any idea why?
bulio is offline   Reply With Quote
Old Jul 12th, 2005, 1:00 PM   #5
tempest
Programming Guru
 
tempest's Avatar
 
Join Date: Oct 2004
Posts: 1,041
Rep Power: 5 tempest is on a distinguished road
Send a message via ICQ to tempest Send a message via AIM to tempest Send a message via Yahoo to tempest
Because the page isn't being posted any POST data via a form.
__________________

tempest is offline   Reply With Quote
Old Jul 12th, 2005, 1:04 PM   #6
skuinders
Hobbyist Programmer
 
skuinders's Avatar
 
Join Date: Jun 2005
Location: MA, US
Posts: 204
Rep Power: 4 skuinders is on a distinguished road
try switching to GET and see if that makes the problem clear
__________________
"A stupid man's report of what a clever man says can never be accurate, because he unconciously translates what he hears into something he can understand."
- B. Russell

http://web.bryant.edu/~srk2
skuinders is offline   Reply With Quote
Old Jul 12th, 2005, 1:05 PM   #7
DaWei
Resident Grouch
 
DaWei's Avatar
 
Join Date: Jun 2005
Posts: 6,453
Rep Power: 10 DaWei is on a distinguished road
@tempest: Your code is also still missing an assignment operator. It might also be more useful to a confused or neophyte OP if you included some commentary in your response. Just a suggestion.
__________________
Abstraction doesn't make it impossible to write bad code; it makes it possible to write superior code.
Contributor's Corner: Grumpy on C++ Exceptions DaWei on Pointers
DaWei is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 4:00 PM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC