crescent Posted April 30, 2006 Share Posted April 30, 2006 I have created a submitting form from where user input his name and his choice (eg. pen, pencil, notebook). he have to choose two item from this three item. But the matter is if a item is already choosen by 10 user so that item will not be inputting into database table and he will get a massege.any body help me please how will I set my logic and code. Link to comment https://forums.phpfreaks.com/topic/8743-row-count/ Share on other sites More sharing options...
OOP Posted April 30, 2006 Share Posted April 30, 2006 can you please post your code so that we can help you more.thanks Link to comment https://forums.phpfreaks.com/topic/8743-row-count/#findComment-32118 Share on other sites More sharing options...
crescent Posted April 30, 2006 Author Share Posted April 30, 2006 Here is my table and code:::::Table Structure::::[code]CREATE TABLE `_item` ( `SL` int(11) unsigned NOT NULL auto_increment, `item_name` varchar(100) NOT NULL default '', PRIMARY KEY (`SL`)) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=5;CREATE TABLE `_name` ( `SL` int(11) unsigned NOT NULL auto_increment, `user_name` varchar(100) NOT NULL default '', PRIMARY KEY (`SL`)) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=5;[/code]:::Code::::[code] for($i=0;$i<count($_POST['i_name']);$i++) { $str=explode("#",$_POST['i_name'][$i]); $i_name=$str[1]; if(($i_name<>"")) { $sql="insert _item(item_name) values ('$i_name')"; $rs=mysql_query($sql); } } if($rs){ $sql1="insert into _name(user_name) values ('$name')"; mysql_query($sql1); }[/code]Please tell me now I will I do that Link to comment https://forums.phpfreaks.com/topic/8743-row-count/#findComment-32148 Share on other sites More sharing options...
OOP Posted April 30, 2006 Share Posted April 30, 2006 Hi there,can you put your form here as well...i am still confused a little it. Link to comment https://forums.phpfreaks.com/topic/8743-row-count/#findComment-32151 Share on other sites More sharing options...
crescent Posted April 30, 2006 Author Share Posted April 30, 2006 [b]:::::::::[!--coloro:#FF9900--][span style=\"color:#FF9900\"][!--/coloro--]Here is my form[!--colorc--][/span][!--/colorc--]::::::::[/b][code]<FORM name="f1" METHOD=POST onSubmit="return EW_checkMyForm(this);" ACTION="action.php"><P align="center"> <TABLE width="896" border=1 bordercolor="#FFC497"> <!--DWLayoutTable--> <TR bgcolor="#E45F05"> <TD height="23" colspan="6" align="center" valign="top"><FONT SIZE='2' face='verdana' color="#FFFFFF"><B>Add New Student Info.</B></FONT></TD> </TR> <TR> <TD width="38" height="28"> </TD> <TD width="94"> </TD> <TD width="247"> </TD> <TD width="155"> </TD> <TD width="69"> </TD> <TD width="253"> </TD> </TR> <TR> <TD height="26" colspan="2"><FONT SIZE='2' face='verdana'>Name</FONT></TD> <TD colspan="4" valign="top"><INPUT TYPE="text" cols=5 NAME="name" size="35"></TD> </TR> <TR> <TD height="26"> </TD> <TD> </TD> <TD> </TD> <TD> </TD> <TD> </TD> <TD> </TD> </TR> <TR> <TD height="28" colspan="6" valign="top"><!--DWLayoutEmptyCell--> </TD> </TR> <TR> <TD height="44" valign="top">SL</TD> <TD colspan="2" valign="top"><font size='2' face='verdana'>Choice</font></TD> <TD valign="top"><font size="2" face="verdana">Cost</font></TD> <TD> </TD> <TD> </TD> </TR> <TR> <TD height="28" valign="top"><font size='2' face='verdana'>1</font></TD> <TD colspan="2" valign="top"><font size='2' face='verdana'> <select name='i_name[]' id="i_name[]" onChange="setCredit(cr0,this.value)"> <option value=''>Select one</option> <?php setCrList();?> </select> </font></TD> <TD valign="top"><font size="2" face="verdana"> <input name="cr0" type="text" id="txt1" value="0" size="25" > </font></TD> <TD> </TD> <TD> </TD> </TR> <TR> <TD height="28" valign="top"><font size='2' face='verdana'>2</font></TD> <TD colspan="2" valign="top"><font size='2' face='verdana'> <select name='i_name[]' id="i_name[]" onChange="setCredit(cr1,this.value)"> <option value=''>Select one</option> <?php setCrList();?> </select> </font></TD> <td valign="top"><font size="2" face="verdana"> <input name="cr1" type="text" id="cr1" value="0" size="25"> </font></td> </TR> <TR> <TD height="36" valign="top"><font size='2' face='verdana'>3</font></TD> <TD colspan="2" valign="top"><font size='2' face='verdana'> <select name='i_name[]' id="i_name[]" onChange="setCredit(cr2,this.value)"> <option value=''>Select one</option> <?php setCrList();?> </select> </font></TD> <td valign="top"><font size="2" face="verdana"> <input name="cr2" type="text" id="cr2" value="0" size="25"> </font></td> </TR> </TR> <TR> <TD height="47" colspan="6" valign="top"><div align="center"> <br> <input name="submit" type="submit" value="Submit"> <input name="reset" type="reset"> </div></TD> </TR> <TR> <TD height="12"></TD> <TD></TD> <TD></TD> <TD></TD> <TD></TD> <TD></TD> </TR> </TABLE></FORM>[/code] Link to comment https://forums.phpfreaks.com/topic/8743-row-count/#findComment-32157 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.