Submit form / MySQL
Code (php)
1
2
3
4
5
6
7
8
9
10
2
3
4
5
6
7
8
9
10
<?php
include "config1.php";
if (strip_tags($_POST['submit']) && strip_tags($_POST['agent'])){
$music=strip_tags($_POST['agent']);
mysql_query("UPDATE prosp SET agent='$music' WHERE name='$b->agent'");
echo "Agent uploaded";
}
?>
include "config1.php";
if (strip_tags($_POST['submit']) && strip_tags($_POST['agent'])){
$music=strip_tags($_POST['agent']);
mysql_query("UPDATE prosp SET agent='$music' WHERE name='$b->agent'");
echo "Agent uploaded";
}
?>
<form method="post" action="index.php">
<table width="100%" border="1" align="center" cellpadding="2" cellspacing="0" bordercolor="black" bgcolor="#FFCC00" class="main" style="border-collapse: collapse">
<!--DWLayoutTable-->
<tr>
<td colspan="5" bgcolor="#FF9900"><div align="center"><strong>Leads</strong> ()</div></td>
</tr>
<tr bgcolor="white">
<td width="283" bgcolor="#FFFFFF" class="tip"><div align="center"><strong><Font color=#737373>Name</strong></div></td>
<td width="306" bgcolor="#FFFFFF" class="tip"><div align="center"><strong><Font color=#737373>Phone</strong></div></td>
<td width="208" bgcolor="#FFFFFF" class="tip"><div align="center"><strong><Font color=#737373>Country</strong></div></td>
<td width="178" bgcolor="#FFFFFF" class="tip"><div align="center"><strong><Font color=#737373>Date</strong></div></td>
<td width="366" bgcolor="#FFFFFF" class="tip"><div align="center"><strong><Font color=#737373>Agent</strong></div></td>
</tr>
Code (php)
1
2
3
4
5
6
2
3
4
5
6
<?
$a=mysql_query("SELECT * FROM prosp ORDER BY country DESC");
while($b=mysql_fetch_object($a)){
echo "<tr><td>$b->name</td><td>$b->phone</td><td>$b->country</td><td>$b->date</td><td>$b->agent <input name='agent' size='20' type='text'><input name='submit' value='submit' type='submit'></td></tr>";
}
?>
$a=mysql_query("SELECT * FROM prosp ORDER BY country DESC");
while($b=mysql_fetch_object($a)){
echo "<tr><td>$b->name</td><td>$b->phone</td><td>$b->country</td><td>$b->date</td><td>$b->agent <input name='agent' size='20' type='text'><input name='submit' value='submit' type='submit'></td></tr>";
}
?>
<br />
</table></form>
Elke rij heeft een aparte submit knop het ziet er eigenlijk al volgt uit
Naam | Phone | ... | ... | Agent
Als een agent een nummer kiest kan hij ze naam achter dat nummber plakken maar dat werkt dus niet, waar zit de fout?
*En sorry voor de onoverzichtelijkheid*
Zet dan alles tussen Code tags.
Code (php)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
<?php
include "config1.php";
if (strip_tags($_POST['submit']) && strip_tags($_POST['agent'])){
$music=strip_tags($_POST['agent']);
mysql_query("UPDATE prosp SET agent='$music' WHERE name='$b->agent'");
echo "Agent uploaded";
}
?>
...
<form method="post" action="index.php">
<table width="100%" border="1" align="center" cellpadding="2" cellspacing="0" bordercolor="black" bgcolor="#FFCC00" class="main" style="border-collapse: collapse">
<!--DWLayoutTable-->
<tr>
<td colspan="5" bgcolor="#FF9900"><div align="center"><strong>Leads</strong> (<? echo $num_rows; ?>)</div></td>
</tr>
<tr bgcolor="white">
<td width="283" bgcolor="#FFFFFF" class="tip"><div align="center"><strong><Font color=#737373>Name</strong></div></td>
<td width="306" bgcolor="#FFFFFF" class="tip"><div align="center"><strong><Font color=#737373>Phone</strong></div></td>
<td width="208" bgcolor="#FFFFFF" class="tip"><div align="center"><strong><Font color=#737373>Country</strong></div></td>
<td width="178" bgcolor="#FFFFFF" class="tip"><div align="center"><strong><Font color=#737373>Date</strong></div></td>
<td width="366" bgcolor="#FFFFFF" class="tip"><div align="center"><strong><Font color=#737373>Agent</strong></div></td>
</tr>
<?
$a=mysql_query("SELECT * FROM prosp ORDER BY country DESC");
while($b=mysql_fetch_object($a)){
echo "<tr><td>$b->name</td><td>$b->phone</td><td>$b->country</td><td>$b->date</td><td>$b->agent <input name='agent' size='20' type='text'><input name='submit' value='submit' type='submit'></td></tr>";
}
?>
<br />
</table></form>
include "config1.php";
if (strip_tags($_POST['submit']) && strip_tags($_POST['agent'])){
$music=strip_tags($_POST['agent']);
mysql_query("UPDATE prosp SET agent='$music' WHERE name='$b->agent'");
echo "Agent uploaded";
}
?>
...
<form method="post" action="index.php">
<table width="100%" border="1" align="center" cellpadding="2" cellspacing="0" bordercolor="black" bgcolor="#FFCC00" class="main" style="border-collapse: collapse">
<!--DWLayoutTable-->
<tr>
<td colspan="5" bgcolor="#FF9900"><div align="center"><strong>Leads</strong> (<? echo $num_rows; ?>)</div></td>
</tr>
<tr bgcolor="white">
<td width="283" bgcolor="#FFFFFF" class="tip"><div align="center"><strong><Font color=#737373>Name</strong></div></td>
<td width="306" bgcolor="#FFFFFF" class="tip"><div align="center"><strong><Font color=#737373>Phone</strong></div></td>
<td width="208" bgcolor="#FFFFFF" class="tip"><div align="center"><strong><Font color=#737373>Country</strong></div></td>
<td width="178" bgcolor="#FFFFFF" class="tip"><div align="center"><strong><Font color=#737373>Date</strong></div></td>
<td width="366" bgcolor="#FFFFFF" class="tip"><div align="center"><strong><Font color=#737373>Agent</strong></div></td>
</tr>
<?
$a=mysql_query("SELECT * FROM prosp ORDER BY country DESC");
while($b=mysql_fetch_object($a)){
echo "<tr><td>$b->name</td><td>$b->phone</td><td>$b->country</td><td>$b->date</td><td>$b->agent <input name='agent' size='20' type='text'><input name='submit' value='submit' type='submit'></td></tr>";
}
?>
<br />
</table></form>
1 formulier met een x-aantal submitknoppen. Dat gaat niet lukken want elke submit zal het complete formulier posten.
Code (php)
1
2
3
4
5
6
7
8
9
2
3
4
5
6
7
8
9
<?php
if (strip_tags($_POST['submit']) && strip_tags($_POST['agent'])){
$music=strip_tags($_POST['agent']);
mysql_query("UPDATE prosp SET agent='$music' WHERE name='$b->agent'");
echo "Agent uploaded";
}
?>
if (strip_tags($_POST['submit']) && strip_tags($_POST['agent'])){
$music=strip_tags($_POST['agent']);
mysql_query("UPDATE prosp SET agent='$music' WHERE name='$b->agent'");
echo "Agent uploaded";
}
?>
Ik heb $b->name ook al geprobeert
Heb je een link naar hoe het nu is?
Ja dat heb ik, hij staat in je intern
En wat is nou precies de bedoeling? Moeten er meerdere inputvelden ingevuld kunnen worden en dan elk ingevuld veld verwerken in de database?
De bedoeling is, stel dat jij een nummer hebt gebelt dan weten de andere dat niet dus dan vul jij je naam in achter het betreffende nummber, bij voorbaat dank voor de moeite SanThe
En nu maar hopen dat SanThe nog online komt vanavond ;-)
Hopelijk (A)
Panic schreef op 14.07.2008 22:05:
De bedoeling is, stel dat jij een nummer hebt gebelt dan weten de andere dat niet dus dan vul jij je naam in achter het betreffende nummber, bij voorbaat dank voor de moeite SanThe
Er wordt dus altijd maar 1 input veld ingevuld?
Edit:
Ja ik bedoel er word 1 naam per keer gedaan, maar alle forms moeten wel gebruikt kunnen worden
Gewijzigd op 01/01/1970 01:00:00 door Panic
PS: Ik ga nu pitten. Ik zal morgen weer kijken als ik tijd heb.
Code (php)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
</table><form method="post" action="index.php">
<table width="100%" border="0">
<tr>
<td width="17%" bgcolor="#FF9900">Lead name: </td>
<td width="83%" bgcolor="#FF9900"><input type=text name=ticket_ids id=ticket_ids size=57></td>
</tr>
<tr>
<td bgcolor="#FF9900">Your name: </td>
<td bgcolor="#FF9900"><input type=text name=Danswer id=Danswer size=57></td>
</tr>
<tr>
<td bgcolor="#FF9900"><input type=submit value=submit name=submit></td>
<td bgcolor="#FF9900"> </td>
</tr>
</table>
<?
if (strip_tags($_POST['submit']) && strip_tags($_POST['ticket_ids']) && strip_tags($_POST['Danswer'])){
$pros=strip_tags($_POST['ticket_ids']);
$agen=strip_tags($_POST['Danswer']);
mysql_query("UPDATE prosp SET agent='$agen' WHERE name='$pros'");
echo "Agent uploaded";
}
?>
<table width="100%" border="0">
<tr>
<td width="17%" bgcolor="#FF9900">Lead name: </td>
<td width="83%" bgcolor="#FF9900"><input type=text name=ticket_ids id=ticket_ids size=57></td>
</tr>
<tr>
<td bgcolor="#FF9900">Your name: </td>
<td bgcolor="#FF9900"><input type=text name=Danswer id=Danswer size=57></td>
</tr>
<tr>
<td bgcolor="#FF9900"><input type=submit value=submit name=submit></td>
<td bgcolor="#FF9900"> </td>
</tr>
</table>
<?
if (strip_tags($_POST['submit']) && strip_tags($_POST['ticket_ids']) && strip_tags($_POST['Danswer'])){
$pros=strip_tags($_POST['ticket_ids']);
$agen=strip_tags($_POST['Danswer']);
mysql_query("UPDATE prosp SET agent='$agen' WHERE name='$pros'");
echo "Agent uploaded";
}
?>