|
|
|||||||||
|
|||||||||
|
|||||||||
| |
|||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
help is there a way to add new fields here
Could someone show me where i could add new fields like username age sate zipcode
<? $error=""; if ($action=="add"){ // add new rating item if ($password=="" || $newname=="" || $newcontact=="" || ($_FILES['picture']['name']=="" && $newpath=="")) $error=$lang['add_uncomplete']; if ($newcontact!="" && !goodEmail($newcontact)) $error.="<br>".$lang['add_bademail']; if ($_FILES['picture']['size']>$maxpicsize) $error.="<br>".$lang['add_toobig']." ".round($maxpicsize/1024,0)." KB!"; if ($error!=""){ $error.="<br><b>".$lang['clickback']."</b>"; echo $error; }else { $newname=strip_tags($newname); $password=strip_tags($password); if ($doapprove){ $approved=0; echo $lang['add_approve']; if ($notifyadmin){ $itemname=$newname; $itemcontact=$newcontact; $message=$lang['add_newitem_mail']; eval ("\$message = \"$message\";"); mail($mailadmin, "$sitename: New Item", $message,"From: $mailadmin"); } }else $approved=1; $sql="INSERT INTO $dbtable (name, contact, cat, pwd, ip, approved, date) VALUES ('$newname', '$newcontact', '$category', '$password', '".$_SERVER['REMOTE_ADDR']."', $approved, $now)"; mysql_query($sql, $db); $res=mysql_query("SELECT id FROM $dbtable ORDER BY id DESC", $db); $nr= mysql_fetch_row($res); if ($uploadpic){ $path=substr($SCRIPT_FILENAME,0,strrpos($SCRIPT_FI LENAME, '/'))."/$imgdir$nr[0].jpg"; if (!move_uploaded_file($_FILES['picture']['tmp_name'], $path)) echo "save error!"; $newpath="$imgdir$nr[0].jpg"; } $sql="UPDATE $dbtable SET path='$newpath' WHERE id=$nr[0]"; mysql_query($sql, $db); echo "<meta http-equiv='refresh' content='4;URL=$PHP_SELF'>"; } }else{ ?> <form name="form2" method="post" action="<?=$PHP_SELF?>" enctype="multipart/form-data"> <table border="0" cellpadding="2" cellspacing="1" bgcolor="<? echo $td_odd;?>" class="votingtxt"> <tr> <td colspan="2" bgcolor="<? echo $td_caption_bg;?>"><font color="<? echo $td_caption_txt;?>"><? echo $lang['add_caption'];?></font></td> </tr> <tr> <td width="50"><? echo $lang['name'];?>:</td> <td><input name="newname" type="text" class="inputfield" id="newname"> </td> </tr> <tr> <td><? echo $lang['contact'];?>:</td> <td><input name="newcontact" type="text" class="inputfield" id="newcontact"> </td> </tr> <tr> <td><? echo $lang['pwd'];?>:</td> <td><input name="password" type="text" class="inputfield" id="password"> </td> </tr> <tr> <td> </td> <td height="30" valign="top" class="votingsmalltxt"><? echo $lang['add_info'];?></td> </tr> <tr> <td><? echo $lang['photo'];?>:</td> <td><? if($uploadpic){?> <input name="picture" type="file" class="inputfield"> <? }else{?> <input name="newpath" type="text" class="inputfield" id="newpath"> Link (URL) <? }?> </td> </tr> <tr> <td><? echo $lang['add_cat'];?>:</td> <td><select class="catlist" name="category"> <? for ($i=1; $i<$numcat; $i++){ echo "<option value='$i'>$cat[$i]</option>"; } ?> </select></td> </tr> <tr> <td> </td> <td><input class="button" name="submit" type="submit" id="add" value="<? echo $lang['add_add'];?>"> <input name="do" type="hidden" id="do" value="add"> <input name="action" type="hidden" id="action" value="add"> </td> </tr> </table> </form><br> <input class="button" type="button" name="Button" value="<? echo $lang['back'];?>" onClick="location.href='<? echo "$PHP_SELF";?>'"> <? }?> |
|
#2
|
||||
|
||||
|
Perhaps within the form where you have name contact and password?
Why not add the fields below that? Code:
<tr> <td width="50"><? echo $lang['field'];?>:</td> <td><input name="field" type="text" class="inputfield" id="field"> </td> </tr> Or have i misinterpreted your question? |
|
#3
|
|||
|
|||
|
thanks that will work
thank for your help
then i add the new fields to my Mysql right? |
|
#4
|
||||
|
||||
|
If they're not present in your table, yes... =)
Try something like this: Code:
ALTER TABLE table ADD COLUMN name |
![]() |
| Viewing: Dev Articles Community Forums > Programming > General Programming Help > help is there a way to add new fields here |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|