Quick fix needed

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
synical21
Forum Contributor
Posts: 150
Joined: Tue Jul 28, 2009 8:44 am
Location: London UK

Quick fix needed

Post by synical21 »

Im having trouble inputting the last part of information from my form.
"Notice: Undefined index: total_cost1 in F:\wamp\www\process.php on line 20"
I think i know the reason i just dont know how to fix it.

This is the html part of the code:

Code: Select all

<b>Estimated Job Cost:$<span id=total_cost1  name=total_cost1></span><br>
This is the process part:

Code: Select all

$sql="INSERT INTO jobs (title, descript, proof, min, amountworkers, totalcost, perperson)
VALUES
('$_POST[title]','$_POST[descript]','$_POST[proof]','$_POST[min]','$_POST[amountworkers]','$_POST[total_cost1]','$_POST[perperson]')";
all the other posts work except for totalcost and i believe it has something to do with the way the total cost is created. Total cost is calculated from other inputs where as the other stuff like title/proof/min there all inputed by the user. so maybe i dont use $_POST for something what isnt inputted by the user? Well i hope i havnt confused you i dont think i explained it very well.

If you need more info just ask.
User avatar
jackpf
DevNet Resident
Posts: 2119
Joined: Sun Feb 15, 2009 7:22 pm
Location: Ipswich, UK

Re: Quick fix needed

Post by jackpf »

Only inputs in forms are sent as post data by the browser, not span tags.

Btw your query is horrible, you should do some validation on your post data, unless you have magic quotes turned on....which really shouldn't be.
Post Reply