Can you please help me with this

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
Barbiegirl
Forum Newbie
Posts: 2
Joined: Tue Sep 25, 2007 5:59 am

Can you please help me with this

Post by Barbiegirl »

Code: Select all

<php?

//CONSTRUCT
<input style="font-size:8pt;" type=submit name=construct value=Construct onClick="arming.php"> 

//This code runs if the form has been submitted
if (isset($_POST['construct'])) { 

// now we insert it into the database
$insert = "INSERT INTO wings (CC5, GB5, Radar5, Runway5, Factory5, NP5, Residence5, PP5, Oil5)
VALUES ('".$_POST['username']."', '".$_POST['pass']."', '".$_POST['pass']."', '".$_POST['pass']."', '".$_POST['pass']."', '".$_POST['pass']."', '".$_POST['pass']."', '".$_POST['pass']."', '".$_POST['pass']."')";
$add_member = mysql_query($insert);







 / 
//DESTROY
 <input style="font-size:8pt;" type=submit name=destroy value=Destroy onClick="arming.php">

//This code runs if the form has been submitted
if (isset($_POST['destroy'])) { 

// now we insert it into the database
$insert = "INSERT INTO wings (CC5, GB5, Radar5, Runway5, Factory5, NP5, Residence5, PP5, Oil5)
VALUES ('".$_POST['username']."', '".$_POST['pass']."', '".$_POST['pass']."', '".$_POST['pass']."', '".$_POST['pass']."', '".$_POST['pass']."', '".$_POST['pass']."', '".$_POST['pass']."', '".$_POST['pass']."')";
$add_member = mysql_query($insert);













 buildings to highlighted sector



<table border=1 bordercolor=#003399 cellspacing=0 width=95%>
	<tr align=center bgcolor=#003399>
		<td><font size=1>Name</td>
		<td><font size=1>Hit<br>Point</td>
		<td><font size=1>Armor</td>
		<td><font size=1>Price<td wrap=><font size=1>Amount</td>
		<td><font size=1>Description</td>
		<td><font size=1>Dependency</td>
	</tr>



//oooooooooo			
<input type=hidden name="npc[]" value=1>
//ooooooooooo
<tr align=center>
	<td><font size=1>Command Center</td>
	<td><font size=1>2200</td>
	<td><font size=1>25</td>
	<td><font size=1>10000</td>
	<td nowrap>
		<img border=0 src=up.gif onClick="UpDown(2,1);">



		<input name="amount[]" type=text size=3 maxlength=3 value=0>



		<img border=0 src=down.gif onClick="UpDown(2,0);">
	</td>
	<td><font size=1>Defensive structures and aircraft controlled by computer can attack enemy</td>
	<td><font size=1> </td>
</tr>









					
<input type=hidden name="npc[]" value=2>
<tr align=center>
	<td><font size=1>Government Bldg.</td>
	<td><font size=1>1500</td>
	<td><font size=1>20</td>
	<td><font size=1>9000</td>
	<td nowrap>
		<img border=0 src=up.gif onClick="UpDown(3,1);">


<input name="amount[]" type=text size=3 maxlength=3 value=0>




		<img border=0 src=down.gif onClick="UpDown(3,0);">
	</td>
	<td><font size=1>Collect tax from residence, 100 credits per residence</td>
	<td><font size=1> </td>
</tr>







					
<input type=hidden name="npc[]" value=3>
<tr align=center>
	<td><font size=1>Radar Station</td>
	<td><font size=1>500</td>
	<td><font size=1>25</td>
	<td><font size=1>3000</td>
	<td nowrap>
		<img border=0 src=up.gif onClick="UpDown(4,1);">
		<input name="amount[]" type=text size=3 maxlength=3 value=0>
		<img border=0 src=down.gif onClick="UpDown(4,0);">
	</td>
	<td><font size=1>Your wing radar while in base</td>
	<td><font size=1>Power Plant/Nuclear Power Plant</td>
</tr>
					
<input type=hidden name="npc[]" value=4>
<tr align=center>
	<td><font size=1>Runway</td>
	<td><font size=1>350</td>
	<td><font size=1>5</td>
	<td><font size=1>1000</td>
	<td nowrap>
		<img border=0 src=up.gif onClick="UpDown(5,1);">
		<input name="amount[]" type=text size=3 maxlength=3 value=0>
		<img border=0 src=down.gif onClick="UpDown(5,0);">
	</td>
	<td><font size=1>Needed for your aircraft to take off</td>
	<td><font size=1></td>
</tr>
					
<input type=hidden name="npc[]" value=5>
<tr align=center>
	<td><font size=1>Factory</td>
	<td><font size=1>800</td>
	<td><font size=1>10</td>
	<td><font size=1>1000</td>
	<td nowrap>
		<img border=0 src=up.gif onClick="UpDown(6,1);">
		<input name="amount[]" type=text size=3 maxlength=3 value=0>
		<img border=0 src=down.gif onClick="UpDown(6,0);">
	</td>
	<td><font size=1>Needed to buy defensive structures;<br>Produce aircraft controlled by computer automatically</td>
	<td><font size=1>Residence, Highway, Power Plant/Nuclear Power Plant</td>
</tr>
					
<input type=hidden name="npc[]" value=6>
<tr align=center>
	<td><font size=1>Nuclear Plant</td>
	<td><font size=1>500</td>
	<td><font size=1>15</td>
	<td><font size=1>5000</td>
	<td nowrap>
		<img border=0 src=up.gif onClick="UpDown(7,1);">
		<input name="amount[]" type=text size=3 maxlength=3 value=0>
		<img border=0 src=down.gif onClick="UpDown(7,0);">
	</td>
	<td><font size=1>Supplies power for factory and radar station</td>
	<td><font size=1>Residence, Highway</td>
</tr>
					
<input type=hidden name="npc[]" value=7>
<tr align=center>
	<td><font size=1>Residence</td>
	<td><font size=1>500</td>
	<td><font size=1>4</td>
	<td><font size=1>1500</td>
	<td nowrap>
		<img border=0 src=up.gif onClick="UpDown(8,1);">
		<input name="amount[]" type=text size=3 maxlength=3 value=0>
		<img border=0 src=down.gif onClick="UpDown(8,0);">
	</td>
	<td><font size=1>Supplies workers for factory, oil refinery and (nuclear) power plant</td>
	<td><font size=1></td>
</tr>
					
<input type=hidden name="npc[]" value=8>
<tr align=center>
	<td><font size=1>Power Plant</td>
	<td><font size=1>700</td>
	<td><font size=1>12</td>
	<td><font size=1>1000</td>
	<td nowrap>
		<img border=0 src=up.gif onClick="UpDown(9,1);">
		<input name="amount[]" type=text size=3 maxlength=3 value=0>
		<img border=0 src=down.gif onClick="UpDown(9,0);">
	</td>
	<td><font size=1>Supplies power for factory and radar station</td>
	<td><font size=1>Residence, Oil Refinery, Highway</td>
</tr>
					
<input type=hidden name="npc[]" value=9>
<tr align=center>
	<td><font size=1>Oil Refinery</td>
	<td><font size=1>700</td>
	<td><font size=1>8</td>
	<td><font size=1>1000</td>
	<td nowrap>
		<img border=0 src=up.gif onClick="UpDown(10,1);">
		<input name="amount[]" type=text size=3 maxlength=3 value=0>
		<img border=0 src=down.gif onClick="UpDown(10,0);">
	</td>
	<td><font size=1>Produces fuel for power plant, enables cheaper fuel</td>
	<td><font size=1>Residence, Highway</td>
</tr>
if you want to know what your actually looking at... its at http://planez.orgfree.com and then sign in, then click ARMING on the left side.. if you dont want to make ur own account just use username: lalalala password: letmein

im pretty new to php........ but what im trying to do.......... is imput DATA into a database......

you have like 10 text fields.......

then two buttons at the top
one says CONSTRUCT
one says DESTROY

so i want to ADD the data too what is aready there..
and then i want on destory to minus.. like this


CC5=CC5 + $_POST... for the construct
CC5=CC5 - $+POST... for the destroy




the thing is....... my brain isnt like smart enough to think this all through at once... and i think im missing some key things..

so if ANYONE could [s]PLS PLS[/s] please please help my msn is love.you.yes@hotmail.com and it would help alot

thanks for reading
[url=http://forums.devnetwork.net/viewtopic.php?t=30037]Forum Rules[/url] Section 1.1 wrote:2. Use descriptive subjects when you start a new thread. Vague titles such as "Help!", "Why?" are misleading and keep you from receiving an answer to your question.
[url=http://forums.devnetwork.net/viewtopic.php?t=30037]Forum Rules[/url] Section 1.1 wrote:11. Please use proper, complete spelling when posting in the forums. AOL Speak, leet speak and other abbreviated wording can confuse those that are trying to help you (or those that you are trying to help). Please keep in mind that there are many people from many countries that use our forums to read, post and learn. They do not always speak English as well as some of us, nor do they know these aberrant abbreviations. Therefore, use as few abbreviations as possible, especially when using such simple words.

Some examples of what not to do are ne1, any1 (anyone); u (you); ur (your or you're); 2 (to too); prolly (probably); afaik (as far as I know); etc.
User avatar
aceconcepts
DevNet Resident
Posts: 1424
Joined: Mon Feb 06, 2006 11:26 am
Location: London

Post by aceconcepts »

Use the

Code: Select all

tags provided in order to display you code
Barbiegirl
Forum Newbie
Posts: 2
Joined: Tue Sep 25, 2007 5:59 am

Post by Barbiegirl »

so can anyone pls help...
User avatar
aceconcepts
DevNet Resident
Posts: 1424
Joined: Mon Feb 06, 2006 11:26 am
Location: London

Post by aceconcepts »

If you are going to add data to data that already exists then you want to "UPDATE" the table.

If you use the

Code: Select all

tags like I said before, you would porbably get more response in the forum.

Anyhow, take a look at this site [url]http://www.w3schools.com/sql/sql_update.asp[/url], it explains it all rather well.

If you run into any problems, just reply to this post.
Post Reply