PHP - Edit Url With Php Code?
Hi,
I hope this can be done and need some advise as to how. I have a search results page that has a URL of: results-page.php?make=FORD&model=TRANSIT--2000-on++Standard+LOW+ROOF+Models&submit.x=22&submit.y=7 Can i create a button or link on that page to adjust the start of the URL but keeping the dynamically created end part? i.e: new-results-page.php?make=FORD&model=TRANSIT--2000-on++Standard+LOW+ROOF+Models&submit.x=22&submit.y=7 I Hope this makes sense. Similar TutorialsI may be on my way to a solution. Question: If the code below will scan ALL fields of my form, how can I add to the code to eliminate just one or two of the inputs, while leaving the remaining 30? $myUpdateList = array();foreach($_POST as $indexName => $value) { $myUpdateList[] = "$indexName = \"$value Hey. So basically I am working on a simple project, I am no PHP expert, I only know a bit of the basics. This project is simply a "performance monitor" script. I have the parts to add records etc. I am now starting to tackle the next phase of the project that is to modify the records to give "infractions" or "bonus". I want to keep this simple and have the following fields on the edit form: PLAYER NAME: Dropdown List of the PLAYER_NAME column on my table called players I grabbed this code from a different thread (and edited it in an attempt to match my table). echo "Select a name: <select name='$name'>"; $query="select PLAYER_NAME from PLAYERS"; $result=mysql_query($query); while($row=mysql_fetch_array($result)){ $name=$row['PLAYER_NAME']; echo "<option value='$name'>$name</option>"; } echo "</select>"; I tried to understand it as I modified it, but aparently I misunderstood it becuase it's not working right, this gives me nothing but an empty dropdown box. Here is a screenshot of my current "players" table, so you can see the structure and what not: INFRACTION/BONUS A box to add or subtract "points". I am thinking along the lines of a number text entry with a radio button for options for either BONUS(add) or INFRACTION (subtract) NOTES Just a simple text box for comments. TIMESTAMP I will do this easily with a field on the SQL table What is wrong with the above PHP code I have for the dropdown box? Also how would I go about making this a usable form? I simply want to create new records with all of the above data on a new table I will create called "infractions". I then want to use the data from the "INFRACTION/BONUS" Field to edit the "ND_POINTS" value on the players table. I know the post is a little long, but I would appreciate any help and guidance you can offer in this project. Thanks.
How to edit my source code so the output prints correctly ?
Hi all, been asked to add a search by model number facility to this website click here for website As you can see the main search facility works just fine and is handled by process.php, but, and for the life of me I can't see why not, I can't get the specific 'search by no.' to work! Any advice appreciated, source code can be provided Thanks Iain I wrote a site for work that holds employee schedule. By demand of my manager she would like an edit function with out having to re-enter the hole thing. She is very BLOND!! the layout has to stay the same other wise she will never figure it out. i need to be query the db pull the info, edit it and send it back or get it info and then delete then enter new. this is the code i already use to query the info from the db: Code: [Select] <? ini_set("display_errors", "1"); error_reporting(E_ALL); include("dbinfo.php"); mysql_connect('localhost',$username,$password); @mysql_select_db($database) or die( "Unable to select database"); $query="SELECT * FROM schedule ORDER BY date DESC LIMIT 2"; $result=mysql_query($query); $num=mysql_numrows($result); mysql_close(); $i=0; while ($i < $num) { $date=mysql_result($result,$i,'date'); $urn=mysql_result($result,$i,'urn'); $date0=mysql_result($result,$i,'date0'); $date1=mysql_result($result,$i,'date1'); $date2=mysql_result($result,$i,'date2'); $date3=mysql_result($result,$i,'date3'); $date4=mysql_result($result,$i,'date4'); $date5=mysql_result($result,$i,'date5'); $date6=mysql_result($result,$i,'date6'); $date7=mysql_result($result,$i,'date7'); $day=mysql_result($result,$i,"day"); $day1=mysql_result($result,$i,"day1"); $day2=mysql_result($result,$i,"day2"); $day3=mysql_result($result,$i,"day3"); $day4=mysql_result($result,$i,"day4"); $day5=mysql_result($result,$i,"day5"); $day6=mysql_result($result,$i,"day6"); $day7=mysql_result($result,$i,"day7"); $row1=mysql_result($result,$i,"row1"); $row2=mysql_result($result,$i,"row2"); $row3=mysql_result($result,$i,"row3"); $row4=mysql_result($result,$i,"row4"); $row5=mysql_result($result,$i,"row5"); $row6=mysql_result($result,$i,"row6"); $row7=mysql_result($result,$i,"row7"); $row8=mysql_result($result,$i,"row8"); $row9=mysql_result($result,$i,"row9"); $row10=mysql_result($result,$i,"row10"); $row11=mysql_result($result,$i,"row11"); $row12=mysql_result($result,$i,"row12"); $row13=mysql_result($result,$i,"row13"); $row14=mysql_result($result,$i,"row14"); $row15=mysql_result($result,$i,"row15"); $row16=mysql_result($result,$i,"row16"); $row17=mysql_result($result,$i,"row17"); $row18=mysql_result($result,$i,"row18"); $row19=mysql_result($result,$i,"row19"); $row20=mysql_result($result,$i,"row20"); $row21=mysql_result($result,$i,"row21"); $row22=mysql_result($result,$i,"row22"); $row23=mysql_result($result,$i,"row23"); $row24=mysql_result($result,$i,"row24"); $row25=mysql_result($result,$i,"row25"); $row26=mysql_result($result,$i,"row26"); $row27=mysql_result($result,$i,"row27"); $row28=mysql_result($result,$i,"row28"); $row29=mysql_result($result,$i,"row29"); $row30=mysql_result($result,$i,"row30"); $row31=mysql_result($result,$i,"row31"); $row32=mysql_result($result,$i,"row32"); $row33=mysql_result($result,$i,"row33"); $row34=mysql_result($result,$i,"row34"); $row35=mysql_result($result,$i,"row35"); $row36=mysql_result($result,$i,"row36"); $row37=mysql_result($result,$i,"row37"); $row38=mysql_result($result,$i,"row38"); $row39=mysql_result($result,$i,"row39"); $row40=mysql_result($result,$i,"row40"); $row41=mysql_result($result,$i,"row41"); $row42=mysql_result($result,$i,"row42"); $row43=mysql_result($result,$i,"row43"); $row44=mysql_result($result,$i,"row44"); $row45=mysql_result($result,$i,"row45"); $row46=mysql_result($result,$i,"row46"); $row47=mysql_result($result,$i,"row47"); $row48=mysql_result($result,$i,"row48"); $row50=mysql_result($result,$i,"row50"); $row51=mysql_result($result,$i,"row51"); $row52=mysql_result($result,$i,"row52"); $row53=mysql_result($result,$i,"row53"); $row54=mysql_result($result,$i,"row54"); $row55=mysql_result($result,$i,"row55"); $row56=mysql_result($result,$i,"row56"); $row57=mysql_result($result,$i,"row57"); $row58=mysql_result($result,$i,"row58"); $row59=mysql_result($result,$i,"row59"); $row60=mysql_result($result,$i,"row60"); $row61=mysql_result($result,$i,"row61"); $row62=mysql_result($result,$i,"row62"); $row63=mysql_result($result,$i,"row63"); $row64=mysql_result($result,$i,"row64"); $row65=mysql_result($result,$i,"row65"); $drive1=mysql_result($result,$i,"drive1"); $drive2=mysql_result($result,$i,"drive2"); $drive3=mysql_result($result,$i,"drive3"); $drive4=mysql_result($result,$i,"drive4"); $drive5=mysql_result($result,$i,"drive5"); $drive6=mysql_result($result,$i,"drive6"); $drive7=mysql_result($result,$i,"drive7"); $drive8=mysql_result($result,$i,"drive8"); $drive9=mysql_result($result,$i,"drive9"); $drive10=mysql_result($result,$i,"drive10"); $drive11=mysql_result($result,$i,"drive11"); $drive12=mysql_result($result,$i,"drive12"); $drive13=mysql_result($result,$i,"drive13"); $drive14=mysql_result($result,$i,"drive14"); $drive15=mysql_result($result,$i,"drive15"); $drive16=mysql_result($result,$i,"drive16"); $drive17=mysql_result($result,$i,"drive17"); $drive18=mysql_result($result,$i,"drive18"); $drive19=mysql_result($result,$i,"drive19"); $drive20=mysql_result($result,$i,"drive20"); $drive21=mysql_result($result,$i,"drive21"); $drive22=mysql_result($result,$i,"drive22"); $drive23=mysql_result($result,$i,"drive23"); $drive24=mysql_result($result,$i,"drive24"); $drive25=mysql_result($result,$i,"drive25"); $drive26=mysql_result($result,$i,"drive26"); $drive27=mysql_result($result,$i,"drive27"); $drive28=mysql_result($result,$i,"drive28"); $drive29=mysql_result($result,$i,"drive29"); $drive30=mysql_result($result,$i,"drive30"); $drive31=mysql_result($result,$i,"drive31"); $drive32=mysql_result($result,$i,"drive32"); $drive33=mysql_result($result,$i,"drive33"); $drive34=mysql_result($result,$i,"drive34"); $drive35=mysql_result($result,$i,"drive35"); $drive36=mysql_result($result,$i,"drive36"); $drive37=mysql_result($result,$i,"drive37"); $drive38=mysql_result($result,$i,"drive38"); $drive39=mysql_result($result,$i,"drive39"); $drive40=mysql_result($result,$i,"drive40"); $drive41=mysql_result($result,$i,"drive41"); $drive42=mysql_result($result,$i,"drive42"); $drive43=mysql_result($result,$i,"drive43"); $drive44=mysql_result($result,$i,"drive44"); $drive45=mysql_result($result,$i,"drive45"); $drive46=mysql_result($result,$i,"drive46"); $drive47=mysql_result($result,$i,"drive47"); $drive48=mysql_result($result,$i,"drive48"); $drive49=mysql_result($result,$i,"drive49"); $drive50=mysql_result($result,$i,"drive50"); $drive51=mysql_result($result,$i,"drive51"); $drive52=mysql_result($result,$i,"drive52"); $drive53=mysql_result($result,$i,"drive53"); $drive54=mysql_result($result,$i,"drive54"); $drive55=mysql_result($result,$i,"drive55"); $drive56=mysql_result($result,$i,"drive56"); $drive57=mysql_result($result,$i,"drive57"); $drive58=mysql_result($result,$i,"drive58"); $drive59=mysql_result($result,$i,"drive59"); $drive60=mysql_result($result,$i,"drive60"); $drive61=mysql_result($result,$i,"drive61"); $drive62=mysql_result($result,$i,"drive62"); $drive63=mysql_result($result,$i,"drive63"); $drive64=mysql_result($result,$i,"drive64"); $drive65=mysql_result($result,$i,"drive65"); $drive66=mysql_result($result,$i,"drive66"); $drive67=mysql_result($result,$i,"drive67"); $drive68=mysql_result($result,$i,"drive68"); $drive69=mysql_result($result,$i,"drive69"); $drive70=mysql_result($result,$i,"drive70"); $drive71=mysql_result($result,$i,"drive71"); $drive72=mysql_result($result,$i,"drive72"); $drive73=mysql_result($result,$i,"drive73"); $drive74=mysql_result($result,$i,"drive74"); $drive75=mysql_result($result,$i,"drive75"); $drive76=mysql_result($result,$i,"drive76"); $drive77=mysql_result($result,$i,"drive77"); $drive78=mysql_result($result,$i,"drive78"); $drive79=mysql_result($result,$i,"drive79"); $drive80=mysql_result($result,$i,"drive80"); ?> <div align="center"> <blink>Warning:</blink> Clicking delete will delete this sechedule (no going back once clicked) <table style="width 87%" border="1" cellspacing="2" cellpadding="2"> <tr> <th><font face="Arial, Helvetica, sans-serif">The Schedule as of: <? echo $date; ?></th> <th><a href="/dominos/admin/delete2.php?urn=<? echo $urn; ?>"><input name='' type='button' value='Delete'/></a></th> <th><a href="../admin/emailit.php"><input type="button" value="Email" /></a></th> <th><a href="../test.php?urn=<? echo $urn; ?>"><input type="button" value="Edit"/></a></th> </tr> </table> <br /> <br /> <input type="text" name="date0" id="date0" value="<? echo $date0; ?>"size="12" maxlength="12" readonly="true" style="font-weight:bold"/> <input type="text" name="date1" id="date1" value="<?php echo $date1; ?>"size="10" maxlength="10" readonly="true" style="font-weight:bold"/> <input type="trans" name="date2" id="date2" value="<?php echo $date2; ?>"size="10" maxlength="10" readonly="true" style="font-weight:bold"/> <input type="text" name="date3" id="date3" value="<?php echo $date3; ?>"size="10" maxlength="10" readonly="true" style="font-weight:bold"/> <input type="text" name="date4" id="date4" value="<?php echo $date4; ?>"size="10" maxlength="10" readonly="true" style="font-weight:bold"/> <input type="text" name="date5" id="date5" value="<?php echo $date5; ?>"size="10" maxlength="10" readonly="true" style="font-weight:bold"/> <input type="text" name="date6" id="date6" value="<?php echo $date6; ?>"size="10" maxlength="10" readonly="true" style="font-weight:bold"/> <input type="text" name="date7" id="date7" value="<?php echo $date7; ?>"size="10" maxlength="10" readonly="true" style="font-weight:bold"/> <br /> <input type="text" name="date0" id="date0" value="<? echo $day; ?>"size="12" maxlength="12" readonly="true" style="font-weight:bold"/> <input type="text" name="date1" id="date1" value="<?php echo $day1; ?>"size="10" maxlength="10" readonly="true" style="font-weight:bold"/> <input type="trans" name="date2" id="date2" value="<?php echo $day2; ?>"size="10" maxlength="10" readonly="true" style="font-weight:bold"/> <input type="text" name="date3" id="date3" value="<?php echo $day3; ?>"size="10" maxlength="10" readonly="true" style="font-weight:bold"/> <input type="text" name="date4" id="date4" value="<?php echo $day4; ?>"size="10" maxlength="10" readonly="true" style="font-weight:bold"/> <input type="text" name="date5" id="date5" value="<?php echo $day5; ?>"size="10" maxlength="10" readonly="true" style="font-weight:bold"/> <input type="text" name="date6" id="date6" value="<?php echo $day6; ?>"size="10" maxlength="10" readonly="true" style="font-weight:bold"/> <input type="text" name="date7" id="date7" value="<?php echo $day7; ?>"size="10" maxlength="10" readonly="true" style="font-weight:bold"/> <br /> <input type="text" name="date0" id="date0" value="<? echo $row1; ?>"size="12" maxlength="12" readonly="true"style="font-weight:bold"/> <input type="text" name="date0" id="date0" value="<? echo $row2; ?>"size="10" maxlength="10" readonly="true" style="font-weight:bold"/> <input type="text" name="date0" id="date0" value="<? echo $row3; ?>"size="10" maxlength="10" readonly="true" style="font-weight:bold"/> <input type="text" name="date0" id="date0" value="<? echo $row4; ?>"size="10" maxlength="10" readonly="true" style="font-weight:bold"/> <input type="text" name="date0" id="date0" value="<? echo $row5; ?>"size="10" maxlength="10" readonly="true" style="font-weight:bold"/> <input type="text" name="date0" id="date0" value="<? echo $row6; ?>"size="10" maxlength="10" readonly="true" style="font-weight:bold"/> <input type="text" name="date0" id="date0" value="<? echo $row7; ?>"size="10" maxlength="10" readonly="true" style="font-weight:bold"/> <input type="text" name="date0" id="date0" value="<? echo $row8; ?>"size="10" maxlength="10" readonly="true" style="font-weight:bold"/> <br /> <input type="text" name="date0" id="date0" value="<? echo $row9; ?>"size="12" maxlength="12" readonly="true" style="font-weight:bold"/> <input type="text" name="date0" id="date0" value="<? echo $row10; ?>"size="10" maxlength="10" readonly="true" style="font-weight:bold"/> <input type="text" name="date0" id="date0" value="<? echo $row11; ?>"size="10" maxlength="10" readonly="true" style="font-weight:bold"/> <input type="text" name="date0" id="date0" value="<? echo $row12; ?>"size="10" maxlength="10" readonly="true" style="font-weight:bold"/> <input type="text" name="date0" id="date0" value="<? echo $row13; ?>"size="10" maxlength="10" readonly="true" style="font-weight:bold"/> <input type="text" name="date0" id="date0" value="<? echo $row14; ?>"size="10" maxlength="10" readonly="true" style="font-weight:bold"/> <input type="text" name="date0" id="date0" value="<? echo $row15; ?>"size="10" maxlength="10" readonly="true" style="font-weight:bold"/> <input type="text" name="date0" id="date0" value="<? echo $row16; ?>"size="10" maxlength="10" readonly="true" style="font-weight:bold"/> <br /> <input type="text" name="date0" id="date0" value="<? echo $row17; ?>"size="12" maxlength="12" readonly="true" style="font-weight:bold"/> <input type="text" name="date0" id="date0" value="<? echo $row18; ?>"size="10" maxlength="10" readonly="true" style="font-weight:bold"/> <input type="text" name="date0" id="date0" value="<? echo $row19; ?>"size="10" maxlength="10" readonly="true" style="font-weight:bold"/> <input type="text" name="date0" id="date0" value="<? echo $row20; ?>"size="10" maxlength="10" readonly="true" style="font-weight:bold"/> <input type="text" name="date0" id="date0" value="<? echo $row21; ?>"size="10" maxlength="10" readonly="true" style="font-weight:bold"/> <input type="text" name="date0" id="date0" value="<? echo $row22; ?>"size="10" maxlength="10" readonly="true" style="font-weight:bold"/> <input type="text" name="date0" id="date0" value="<? echo $row23; ?>"size="10" maxlength="10" readonly="true" style="font-weight:bold"/> <input type="text" name="date0" id="date0" value="<? echo $row24; ?>"size="10" maxlength="10" readonly="true" style="font-weight:bold"/> <br /> <input type="text" name="date0" id="date0" value="<? echo $row25; ?>"size="12" maxlength="12" readonly="true" style="font-weight:bold"/> <input type="text" name="date0" id="date0" value="<? echo $row26; ?>"size="10" maxlength="10" readonly="true" style="font-weight:bold"/> <input type="text" name="date0" id="date0" value="<? echo $row27; ?>"size="10" maxlength="10" readonly="true" style="font-weight:bold"/> <input type="text" name="date0" id="date0" value="<? echo $row28; ?>"size="10" maxlength="10" readonly="true" style="font-weight:bold"/> <input type="text" name="date0" id="date0" value="<? echo $row29; ?>"size="10" maxlength="10" readonly="true" style="font-weight:bold"/> <input type="text" name="date0" id="date0" value="<? echo $row30; ?>"size="10" maxlength="10" readonly="true" style="font-weight:bold"/> <input type="text" name="date0" id="date0" value="<? echo $row31; ?>"size="10" maxlength="10" readonly="true" style="font-weight:bold"/> <input type="text" name="date0" id="date0" value="<? echo $row32; ?>"size="10" maxlength="10" readonly="true" style="font-weight:bold"/> <br /> <input type="text" name="date0" id="date0" value="<? echo $row33; ?>"size="12" maxlength="12" readonly="true" style="font-weight:bold"/> <input type="text" name="date0" id="date0" value="<? echo $row34; ?>"size="10" maxlength="10" readonly="true" style="font-weight:bold"/> <input type="text" name="date0" id="date0" value="<? echo $row35; ?>"size="10" maxlength="10" readonly="true" style="font-weight:bold"/> <input type="text" name="date0" id="date0" value="<? echo $row36; ?>"size="10" maxlength="10" readonly="true" style="font-weight:bold"/> <input type="text" name="date0" id="date0" value="<? echo $row37; ?>"size="10" maxlength="10" readonly="true" style="font-weight:bold"/> <input type="text" name="date0" id="date0" value="<? echo $row38; ?>"size="10" maxlength="10" readonly="true" style="font-weight:bold"/> <input type="text" name="date0" id="date0" value="<? echo $row39; ?>"size="10" maxlength="10" readonly="true" style="font-weight:bold"/> <input type="text" name="date0" id="date0" value="<? echo $row40; ?>"size="10" maxlength="10" readonly="true" style="font-weight:bold"/> <br /> <input type="text" name="date0" id="date0" value="<? echo $row41; ?>"size="12" maxlength="12" readonly="true" style="font-weight:bold"/> <input type="text" name="date0" id="date0" value="<? echo $row42; ?>"size="10" maxlength="10" readonly="true" style="font-weight:bold"/> <input type="text" name="date0" id="date0" value="<? echo $row43; ?>"size="10" maxlength="10" readonly="true" style="font-weight:bold"/> <input type="text" name="date0" id="date0" value="<? echo $row44; ?>"size="10" maxlength="10" readonly="true" style="font-weight:bold"/> <input type="text" name="date0" id="date0" value="<? echo $row45; ?>"size="10" maxlength="10" readonly="true" style="font-weight:bold"/> <input type="text" name="date0" id="date0" value="<? echo $row46; ?>"size="10" maxlength="10" readonly="true" style="font-weight:bold"/> <input type="text" name="date0" id="date0" value="<? echo $row47; ?>"size="10" maxlength="10" readonly="true" style="font-weight:bold"/> <input type="text" name="date0" id="date0" value="<? echo $row48; ?>"size="10" maxlength="10" readonly="true" style="font-weight:bold"/> <br /> <input type="text" name="date0" id="date0" value="<? echo $row50; ?>"size="12" maxlength="12" readonly="true" style="font-weight:bold"/> <input type="text" name="date0" id="date0" value="<? echo $row51; ?>"size="10" maxlength="10" readonly="true" style="font-weight:bold"/> <input type="text" name="date0" id="date0" value="<? echo $row52; ?>"size="10" maxlength="10" readonly="true" style="font-weight:bold"/> <input type="text" name="date0" id="date0" value="<? echo $row53; ?>"size="10" maxlength="10" readonly="true" style="font-weight:bold"/> <input type="text" name="date0" id="date0" value="<? echo $row54; ?>"size="10" maxlength="10" readonly="true" style="font-weight:bold"/> <input type="text" name="date0" id="date0" value="<? echo $row55; ?>"size="10" maxlength="10" readonly="true" style="font-weight:bold"/> <input type="text" name="date0" id="date0" value="<? echo $row56; ?>"size="10" maxlength="10" readonly="true" style="font-weight:bold"/> <input type="text" name="date0" id="date0" value="<? echo $row57; ?>"size="10" maxlength="10" readonly="true" style="font-weight:bold"/> <br /> <input type="text" name="date0" id="date0" value="<? echo $row58; ?>"size="12" maxlength="12" readonly="true" style="font-weight:bold"/> <input type="text" name="date0" id="date0" value="<? echo $row59; ?>"size="10" maxlength="10" readonly="true" style="font-weight:bold"/> <input type="text" name="date0" id="date0" value="<? echo $row60; ?>"size="10" maxlength="10" readonly="true" style="font-weight:bold"/> <input type="text" name="date0" id="date0" value="<? echo $row61; ?>"size="10" maxlength="10" readonly="true" style="font-weight:bold"/> <input type="text" name="date0" id="date0" value="<? echo $row62; ?>"size="10" maxlength="10" readonly="true" style="font-weight:bold"/> <input type="text" name="date0" id="date0" value="<? echo $row63; ?>"size="10" maxlength="10" readonly="true" style="font-weight:bold"/> <input type="text" name="date0" id="date0" value="<? echo $row64; ?>"size="10" maxlength="10" readonly="true" style="font-weight:bold"/> <input type="text" name="date0" id="date0" value="<? echo $row65; ?>"size="10" maxlength="10" readonly="true" style="font-weight:bold"/> <br /> <br /> <input type="text" name="date0" id="date0" value="<? echo $drive1; ?>"size="12" maxlength="12" readonly="true" style="font-weight:bold" /> <input type="text" name="date0" id="date0" value="<? echo $drive2; ?>"size="10" maxlength="10" readonly="true" style="font-weight:bold"/> <input type="text" name="date0" id="date0" value="<? echo $drive3; ?>"size="10" maxlength="10" readonly="true" style="font-weight:bold"/> <input type="text" name="date0" id="date0" value="<? echo $drive4; ?>"size="10" maxlength="10" readonly="true" style="font-weight:bold"/> <input type="text" name="date0" id="date0" value="<? echo $drive5; ?>"size="10" maxlength="10" readonly="true" style="font-weight:bold"/> <input type="text" name="date0" id="date0" value="<? echo $drive6; ?>"size="10" maxlength="10" readonly="true" style="font-weight:bold"/> <input type="text" name="date0" id="date0" value="<? echo $drive7; ?>"size="10" maxlength="10" readonly="true" style="font-weight:bold"/> <input type="text" name="date0" id="date0" value="<? echo $drive8; ?>"size="10" maxlength="10" readonly="true" style="font-weight:bold"/> <br /> <input type="text" name="date0" id="date0" value="<? echo $drive9; ?>"size="12" maxlength="12" readonly="true" style="font-weight:bold"/> <input type="text" name="date0" id="date0" value="<? echo $drive10; ?>"size="10" maxlength="10" readonly="true" style="font-weight:bold"/> <input type="text" name="date0" id="date0" value="<? echo $drive11; ?>"size="10" maxlength="10" readonly="true" style="font-weight:bold"/> <input type="text" name="date0" id="date0" value="<? echo $drive12; ?>"size="10" maxlength="10" readonly="true" style="font-weight:bold"/> <input type="text" name="date0" id="date0" value="<? echo $drive13; ?>"size="10" maxlength="10" readonly="true" style="font-weight:bold"/> <input type="text" name="date0" id="date0" value="<? echo $drive14; ?>"size="10" maxlength="10" readonly="true" style="font-weight:bold"/> <input type="text" name="date0" id="date0" value="<? echo $drive15; ?>"size="10" maxlength="10" readonly="true" style="font-weight:bold"/> <input type="text" name="date0" id="date0" value="<? echo $drive16; ?>"size="10" maxlength="10" readonly="true" style="font-weight:bold"/> <br /> <input type="text" name="date0" id="date0" value="<? echo $drive17; ?>"size="12" maxlength="12" readonly="true" style="font-weight:bold"/> <input type="text" name="date0" id="date0" value="<? echo $drive18; ?>"size="10" maxlength="10" readonly="true" style="font-weight:bold"/> <input type="text" name="date0" id="date0" value="<? echo $drive19; ?>"size="10" maxlength="10" readonly="true" style="font-weight:bold"/> <input type="text" name="date0" id="date0" value="<? echo $drive20; ?>"size="10" maxlength="10" readonly="true" style="font-weight:bold"/> <input type="text" name="date0" id="date0" value="<? echo $drive21; ?>"size="10" maxlength="10" readonly="true" style="font-weight:bold"/> <input type="text" name="date0" id="date0" value="<? echo $drive22; ?>"size="10" maxlength="10" readonly="true" style="font-weight:bold"/> <input type="text" name="date0" id="date0" value="<? echo $drive23; ?>"size="10" maxlength="10" readonly="true" style="font-weight:bold"/> <input type="text" name="date0" id="date0" value="<? echo $drive24; ?>"size="10" maxlength="10" readonly="true" style="font-weight:bold"/> <br /> <input type="text" name="date0" id="date0" value="<? echo $drive25; ?>"size="12" maxlength="12" readonly="true" style="font-weight:bold"/> <input type="text" name="date0" id="date0" value="<? echo $drive26; ?>"size="10" maxlength="10" readonly="true" style="font-weight:bold"/> <input type="text" name="date0" id="date0" value="<? echo $drive27; ?>"size="10" maxlength="10" readonly="true" style="font-weight:bold"/> <input type="text" name="date0" id="date0" value="<? echo $drive28; ?>"size="10" maxlength="10" readonly="true" style="font-weight:bold"/> <input type="text" name="date0" id="date0" value="<? echo $drive29; ?>"size="10" maxlength="10" readonly="true" style="font-weight:bold"/> <input type="text" name="date0" id="date0" value="<? echo $drive30; ?>"size="10" maxlength="10" readonly="true" style="font-weight:bold"/> <input type="text" name="date0" id="date0" value="<? echo $drive31; ?>"size="10" maxlength="10" readonly="true" style="font-weight:bold"/> <input type="text" name="date0" id="date0" value="<? echo $drive32; ?>"size="10" maxlength="10" readonly="true" style="font-weight:bold"/> <br /> <input type="text" name="date0" id="date0" value="<? echo $drive33; ?>"size="12" maxlength="12" readonly="true" style="font-weight:bold"/> <input type="text" name="date0" id="date0" value="<? echo $drive34; ?>"size="10" maxlength="10" readonly="true" style="font-weight:bold"/> <input type="text" name="date0" id="date0" value="<? echo $drive35; ?>"size="10" maxlength="10" readonly="true" style="font-weight:bold"/> <input type="text" name="date0" id="date0" value="<? echo $drive36; ?>"size="10" maxlength="10" readonly="true" style="font-weight:bold"/> <input type="text" name="date0" id="date0" value="<? echo $drive37; ?>"size="10" maxlength="10" readonly="true" style="font-weight:bold"/> <input type="text" name="date0" id="date0" value="<? echo $drive38; ?>"size="10" maxlength="10" readonly="true" style="font-weight:bold"/> <input type="text" name="date0" id="date0" value="<? echo $drive39; ?>"size="10" maxlength="10" readonly="true" style="font-weight:bold"/> <input type="text" name="date0" id="date0" value="<? echo $drive40; ?>"size="10" maxlength="10" readonly="true" style="font-weight:bold"/> <br /> <input type="text" name="date0" id="date0" value="<? echo $drive41; ?>"size="12" maxlength="12" readonly="true" style="font-weight:bold"/> <input type="text" name="date0" id="date0" value="<? echo $drive42; ?>"size="10" maxlength="10" readonly="true" style="font-weight:bold"/> <input type="text" name="date0" id="date0" value="<? echo $drive43; ?>"size="10" maxlength="10" readonly="true" style="font-weight:bold"/> <input type="text" name="date0" id="date0" value="<? echo $drive44; ?>"size="10" maxlength="10" readonly="true" style="font-weight:bold"/> <input type="text" name="date0" id="date0" value="<? echo $drive45; ?>"size="10" maxlength="10" readonly="true" style="font-weight:bold"/> <input type="text" name="date0" id="date0" value="<? echo $drive46; ?>"size="10" maxlength="10" readonly="true" style="font-weight:bold"/> <input type="text" name="date0" id="date0" value="<? echo $drive47; ?>"size="10" maxlength="10" readonly="true" style="font-weight:bold"/> <input type="text" name="date0" id="date0" value="<? echo $drive48; ?>"size="10" maxlength="10" readonly="true" style="font-weight:bold"/> <br /> <input type="text" name="date0" id="date0" value="<? echo $drive49; ?>"size="12" maxlength="12" readonly="true" style="font-weight:bold"/> <input type="text" name="date0" id="date0" value="<? echo $drive50; ?>"size="10" maxlength="10" readonly="true" style="font-weight:bold"/> <input type="text" name="date0" id="date0" value="<? echo $drive51; ?>"size="10" maxlength="10" readonly="true" style="font-weight:bold"/> <input type="text" name="date0" id="date0" value="<? echo $drive52; ?>"size="10" maxlength="10" readonly="true" style="font-weight:bold"/> <input type="text" name="date0" id="date0" value="<? echo $drive53; ?>"size="10" maxlength="10" readonly="true" style="font-weight:bold"/> <input type="text" name="date0" id="date0" value="<? echo $drive54; ?>"size="10" maxlength="10" readonly="true" style="font-weight:bold"/> <input type="text" name="date0" id="date0" value="<? echo $drive55; ?>"size="10" maxlength="10" readonly="true" style="font-weight:bold"/> <input type="text" name="date0" id="date0" value="<? echo $drive56; ?>"size="10" maxlength="10" readonly="true" style="font-weight:bold"/> <br /> <input type="text" name="date0" id="date0" value="<? echo $drive57; ?>"size="12" maxlength="12" readonly="true" style="font-weight:bold"/> <input type="text" name="date0" id="date0" value="<? echo $drive58; ?>"size="10" maxlength="10" readonly="true" style="font-weight:bold"/> <input type="text" name="date0" id="date0" value="<? echo $drive59; ?>"size="10" maxlength="10" readonly="true" style="font-weight:bold"/> <input type="text" name="date0" id="date0" value="<? echo $drive60; ?>"size="10" maxlength="10" readonly="true" style="font-weight:bold"/> <input type="text" name="date0" id="date0" value="<? echo $drive61; ?>"size="10" maxlength="10" readonly="true" style="font-weight:bold"/> <input type="text" name="date0" id="date0" value="<? echo $drive62; ?>"size="10" maxlength="10" readonly="true" style="font-weight:bold"/> <input type="text" name="date0" id="date0" value="<? echo $drive63; ?>"size="10" maxlength="10" readonly="true" style="font-weight:bold"/> <input type="text" name="date0" id="date0" value="<? echo $drive64; ?>"size="10" maxlength="10" readonly="true" style="font-weight:bold"/> <br /> <input type="text" name="date0" id="date0" value="<? echo $drive65; ?>"size="12" maxlength="12" readonly="true" style="font-weight:bold"/> <input type="text" name="date0" id="date0" value="<? echo $drive66; ?>"size="10" maxlength="10" readonly="true" style="font-weight:bold"/> <input type="text" name="date0" id="date0" value="<? echo $drive67; ?>"size="10" maxlength="10" readonly="true" style="font-weight:bold"/> <input type="text" name="date0" id="date0" value="<? echo $drive68; ?>"size="10" maxlength="10" readonly="true" style="font-weight:bold"/> <input type="text" name="date0" id="date0" value="<? echo $drive69; ?>"size="10" maxlength="10" readonly="true" style="font-weight:bold"/> <input type="text" name="date0" id="date0" value="<? echo $drive70; ?>"size="10" maxlength="10" readonly="true" style="font-weight:bold"/> <input type="text" name="date0" id="date0" value="<? echo $drive71; ?>"size="10" maxlength="10" readonly="true" style="font-weight:bold"/> <input type="text" name="date0" id="date0" value="<? echo $drive72; ?>"size="10" maxlength="10" readonly="true" style="font-weight:bold"/> <br /> <input type="text" name="date0" id="date0" value="<? echo $drive73; ?>"size="12" maxlength="12" readonly="true" style="font-weight:bold"/> <input type="text" name="date0" id="date0" value="<? echo $drive74; ?>"size="10" maxlength="10" readonly="true" style="font-weight:bold"/> <input type="text" name="date0" id="date0" value="<? echo $drive75; ?>"size="10" maxlength="10" readonly="true" style="font-weight:bold"/> <input type="text" name="date0" id="date0" value="<? echo $drive76; ?>"size="10" maxlength="10" readonly="true" style="font-weight:bold"/> <input type="text" name="date0" id="date0" value="<? echo $drive77; ?>"size="10" maxlength="10" readonly="true" style="font-weight:bold"/> <input type="text" name="date0" id="date0" value="<? echo $drive78; ?>"size="10" maxlength="10" readonly="true" style="font-weight:bold"/> <input type="text" name="date0" id="date0" value="<? echo $drive79; ?>"size="10" maxlength="10" readonly="true" style="font-weight:bold"/> <input type="text" name="date0" id="date0" value="<? echo $drive80; ?>"size="10" maxlength="10" readonly="true" style="font-weight:bold"/> <br /> <br /> <br /> <br /> <? $i++;} ?> hello mates, I am needing help on editing a line in Flat File Database. I got it to pull the data i need out by using id but not sure on how i would go about getting it to update the FFD heres what i got so far $id2 = $_REQUEST['id']; $id = array(); $username = array(); $title = array(); $date = array(); $message = array(); $lines = file('../news/news.db'); foreach($lines as $line){ if($id != $id2) { $explode = explode("||",$line); $id = $explode[0]; $username = $explode[1]; $title = $explode[2]; $date = $explode[3]; $message = $explode[4]; } } ?> <form action="edit_news2.php?id=<?php echo $id; ?>" method="post" name="editnews"> <table width="100%"> <tr><td><input name="id" value="<?php echo "$id;" ?>" type="hidden" />UserName:</td><td> <input name="userName" value="<?php echo "$username" ?>" type="text" readonly="true" /></td></tr> <tr><td>News Title:</td><td> <input name="title" type="text" value="<?php echo "$title"; ?>" /></td></tr> <tr><td>Date/Time:</td><td> <input name="datetime" value="<?php echo "$date"; ?>" type="text" readonly="true" /></td></tr> <tr><td colspan="2">Message:</td></tr> <tr><td colspan="2"><textarea name="message" cols="50" rows="15"><?php echo "$message"; ?></textarea></td></tr> <tr><td colspan="2" align="center"><input type="submit" name="submitBtn" value="Post News" /></td></tr> </table> </form> thank you Valkeri2010 I'm using php edit function to edit an php file online. I think the portion that writing the file is below. My issue is that wherever there's a quote ("), it's automatically adding a slash (\). For example, if I had class="abc", it changes to class=\"abc\". How do I fix this? Code: [Select] <?php $file = $_GET['f']; $script = $_POST['script']; if($file&&$script) { $fp=fopen($file, "w"); fwrite($fp,$script); fclose($fp); } ?> ok i want admin to click on the edit button and a form shows up where you can edit your events and stuff like that but i cant get the edit button to work Code: [Select] <?php require 'scripts/connect.php'; echo " <table width='472' border='0'> <tr> <th width='43' height='21' scope='col'>Event Id</th> <th width='116' scope='col'>Event Nane</th> <th width='106' scope='col'>Event Type</th> <th width='63' scope='col'>EDIT</th> <th width='63' scope='col'>DELETE</th> </tr> </table>"; $sqlCommand = "SELECT * FROM events"; $out = mysql_query($sqlCommand); while ($row = mysql_fetch_assoc($out)){ $eventid = $row["id"]; $eventname = $row["eventname"]; $eventtype = $row["typeevent"]; $eventinfo = $row["eventinfo"]; $date = $row["date"]; $time = $row["time"]; $livetickets = $row["sale"]; $numtickets = $row["numtickets"]; $pricestudents = $row["studentsprice"]; $priceseniors = $row["seniorsprice"]; $priceadults = $row["adultsprice"]; if ($_POST['editbtn']){ echo "<form action='editevent' method='post'> <table> <tr> <td>Event Name</td> <td></td> <tr> <tr> <td></td> <td></td> <tr> <tr> <td></td> <td></td> <tr> </table> </form> "; }else echo" <table width='472' border='0'> <tr><form action='editevent.php' method='post'> <th width='59' height='21' scope='col'>$eventid</th> <th width='159' scope='col'>$eventname</th> <th width='151' scope='col'>$eventtype</th> <th width='85' scope='col'><input type='button' name='editbtn' value='Edit' /></th> <th width='85' scope='col'><input type='button' name='deletebtn' value='Delete' /></th> </form></tr> </table>"; } ?> Hi. I am working on a website that has restriction level. An admin, a staff, and ordinary user. In my admin page when I click the button "View Users" it shows all the listed users in a table, from admin to ordinary users. And on each entry is an option to either "Delete" or "Edit" the users account. Now I have a problem with editing user profile because it appears blank fields. Not like in the admin side wherein if I click "Edit" the fields are filled with the users info. How do I do this in the staff's page. Here is the view users code from the admin's page: Code: [Select] if (@$_GET['action'] == "View Users") { print "<font size=6 color=yellow><center>View User's Records</center><br></font>"; $result = mysql_query ("SELECT * FROM users order by user_lvl, lname asc"); $rows = mysql_num_rows($result); if ($rows!=0) { print "<table border=1 align=center cellspacing=10>"; print " <tr bgcolor=yellow align=center> <td>First Name</td> <td>Last Name</td> <td>Email</td> <td>Username</td> <td>Password</td> <td>Phone Number</td> <td>User Privilege</td> <td>Options</td> </tr>"; for ($i=0; $i< $rows; $i++) { $row = mysql_fetch_row ($result); print "<tr bgcolor= white align=center>"; print "<td>$row[0]</td>"; print "<td>$row[1]</td>"; print "<td>$row[2]</td>"; print "<td>$row[3]</td>"; print "<td>$row[4]</td>"; print "<td>$row[5]</td>"; print "<td>$row[6]</td>"; print "<td>[ <a href=admin_main.php?action=Delete&username=$row[3]>Delete</a> ]"; print "[ <a href=admin_main.php?action=Edit&username=$row[3]>Edit</a> ]"; print "</td>"; print "</tr>"; } print "</table>"; print "<font size=1 color=yellow>Number of entries found: $rows"; } else { print "No records found!"; } mysql_free_result ($result); } Now here is the code when I click "Edit" from the "View Users" table: Code: [Select] if (@$_GET['action'] == "Edit") { $result = mysql_query ("Select * from users where username='$_GET[username]'"); $row = mysql_fetch_row ($result); print "<font size=6 color=yellow><center>Edit Records </center></font>"; print "<form method = get> <table border = 1 align=center> <tr> <td><font color=yellow>First Name:</font></td> <td><input type=text name=fname value=$row[0] ></td></tr> <tr> <td><font color=yellow>Last Name:</font></td> <td><input type=text name=lname value=$row[1]></td></tr> <tr> <td><font color=yellow>Email Address: </font></td> <td><input type=text name=email value=$row[2] </td></tr> <tr> <td><font color=yellow>Username: </font></td> <td><input type = text name = username value=$row[3] ></td></tr> <tr> <td><font color=yellow>Password:</font></td> <td><input type=text name=password value=$row[4]></td></tr> <tr> <td><font color=yellow>Contact Number:</font></td> <td><input type = text name = phone_number value=$row[5]></td></tr> <tr> <td><font color=yellow>User Privilege:</font></td> <td><input type = txt name = user_lvl value=$row[6]></td></tr> <tr><td><input type=submit value='Update Users' Submit name=action></td></tr> </table> </form> "; } if (@$_GET['action']=="Update Users") { $result = mysql_query ("UPDATE users SET fname='$_GET[fname]', lname='$_GET[lname]', email='$_GET[email]', username='$_GET[username]', password='$_GET[password]', phone_number='$_GET[phone_number]', user_lvl='$_GET[user_lvl]' where username= '$_GET[username]'"); print "<font size=6 color=yellow><center><blink>Record of User successfully updated!</blink></center></font>"; } Hi all, I don't know if it is possible but i need to edit one word document, write the name of the customer in it, but at the right place and print it from a php form. The user write in that php form the customer id and if he exists, the system should modify the word template and print it. Do you think this is possible and if so how can i do that? Thanks in advance. Hugo Hi Guys, I have a list of branches in a database table with the following collumns, Ter BranchName BranchAddress BranchTel BranchEmail BranchLink Ter = Terriotory ID However every time i update a branch using the edit.php code it always sets the Ter as 1 again! Rather than leaving it the same. The actual field is read-only to prevent that from happening. It then always comes up with the error Duplicate entry '1' for key 1 but thats because there is already a branch with Ter=1 include('config.php'); if (isset($_GET['Ter']) ) { $ter = (int) $_GET['Ter']; if (isset($_POST['submitted'])) { foreach($_POST AS $key => $value) { $_POST[$key] = mysql_real_escape_string($value); } $sql = "UPDATE `ter` SET `Ter` = `BranchName` = '{$_POST['BranchName']}' , `BranchAddress` = '{$_POST['BranchAddress']}' , `BranchTel` = '{$_POST['BranchTel']}' , `BranchEmail` = '{$_POST['BranchEmail']}' , `BranchLink` = '{$_POST['BranchLink']}' WHERE `Ter` = '$ter' "; mysql_query($sql) or die(mysql_error()); echo (mysql_affected_rows()) ? "Edited Branch.<br />" : "Nothing changed. <br />"; } $row = mysql_fetch_array ( mysql_query("SELECT * FROM `ter` WHERE `Ter` = '$ter' ")); <form action='' method='POST'> <p><b>Territory:</b><br /><input name='Ter' type='text' value='<?= stripslashes($row['Ter']) ?>' size="3" readonly="readonly" /> <p><b>Branch Name:</b><br /><input name='BranchName' type='text' value='<?= stripslashes($row['BranchName']) ?>' size="50" /> <p><b>Address:</b><br /> <textarea name="BranchAddress" cols="40" rows="5"><?= stripslashes($row['BranchAddress']) ?></textarea> <p><b>Telephone:</b><br /><input name='BranchTel' type='text' value='<?= stripslashes($row['BranchTel']) ?>' size="15" /> <p><b>Email:</b><br /><input name='BranchEmail' type='text' value='<?= stripslashes($row['BranchEmail']) ?>' size="50" /> <p><b>Link:</b><br /><input name='BranchLink' type='text' value='<?= stripslashes($row['BranchLink']) ?>' size="50" /> <p><input type='submit' value='Save' /><input type='hidden' value='1' name='submitted' /> </form> <? } ?> Any Ideas? Cheers, S hi...again got in a mess...i m developing this ticketing system where once i check the checkbox and press the edit button,it takes me to the edit page with the same ticket no to be printed there....how do i do this i have attached the two pages for your smooth understanding attachment 1-->page where i check the ticket no from a list of ticket nos attachment2-->page where the ticket no must be displayed as checked on the previous page help is appreciated in advance.... Hi I am trying to develop an editprofile.php page to allow users to change their details. So far i have written Code: [Select] <?php $result = mysql_query("SELECT username FROM users WHERE username = {$_SESSION['MM_Username']}"); $num_rows = mysql_num_rows($result); if($num_rows > 0) { while ($row = mysql_fetch_array($result)) { $username = $row['username']; } } ?> and then tried to test it by using Code: [Select] <div><?php echo $username ?></div> but nothing is being echo'ed out. What am i doing wrong? Hello people, well the question couldn't be more explicit. I just learned how to view the php.ini configuration of my server using the phpinfo()script. But apparently it is a read only file. So how does one edit it? I am trying to extend session timeout. Thanks. Hello I work on my school project where we have to create a website with front and back end. So I decided to create a lyrics website. I created a DB, with a table table called "lyrics" This is the structu CREATE TABLE lyrics ( lyricsId int(8) PRIMARY KEY AUTO_INCREMENT, artist varchar(100), song varchar(100), cover varchar(100), lyrics varchar(9999), chartId int(8), commentId int(8), FOREIGN KEY (chartId) REFERENCES charts(chartId), ); So right now I dont know how I can create a Editlyrics.php button where I can edit he lyrics by the ID page for example I have 2 sogns with lyrics and when i press on a song i go to the lyris of that song, and on that page I want to have a button where i can edit the lyrics. Tjis is what i did: I created a editlyrics.php file and added this code, but its not working and I know for a fact that nothing is right here, there are so many errors, but I dont know what the errors are or how can i fix this... <?php session_start(); include("connectdb.php"); $id = $_SESSION['id']; $lyricsId = $_POST['lyricsId']; $col = "UNDEFINED"; if(isset($_POST['lyricsId'])){ $col = "lyrics"; $val = $_POST['lyrics']; } $query = "UPDATE lyrics SET $col='$val' WHERE lyricsId=$id;"; if(mysqli_query($dbc_form,$query)){ header("Location: index.php"); }else{ $_SESSION['error_msg'] = "Same Lyrics!"; header("Location: index.php"); } ?> Any help? thanks Hi can anyone please help me, I have to create a edit page that retrieves information from a list so that a user can change the text. The page looks fine but when I enter data in the fields and update it leaves the page as it was retrieved. I am a beginner! My code looks like this: Code: [Select] <form method = "get" action = "edit.php"> <?php //check to see if user is logged on session_start(); if (!(isset($_SESSION['login']) && $_SESSION['login'] != "")) { header ("Location:login.php"); } include('connect.php'); //connection details to database in a connect.php page $product_id = $_GET['product_id']; $query = "SELECT * FROM products WHERE product_id = '$product_id'"; $result = mysql_query($query); while($row = mysql_fetch_array($result)){ $product_id = $row['product_id']; echo "<table>"; echo "<tr>"; echo "<td><input name = 'product_id' type = 'hidden' value ='$row[product_id]'></td>"; echo "</tr>"; echo "<tr>"; echo "<td>Product Name:</td><td><input name = 'pname' type = 'text' value ='$row[product_name]'></td>"; echo "</tr>"; echo "<tr>"; echo "<td>Product Range:</td><td><input name = 'prange' type = 'text' value ='$row[product_range]'></td>"; echo "</tr>"; echo "<tr>"; echo "<td>Product Price:</td><td><input name = 'pprice' type = 'text' value ='$row[product_price]'></td>"; echo "</tr>"; echo "<tr>"; echo "<td><input type = 'submit' name = 'Submit' value = 'Update'></td>"; echo "</tr>"; echo "</table>"; } //if form was submitted if ($_SERVER['REQUEST_METHOD'] == 'POST'){ //get values from fields $productname = $_POST['pname']; $range = $_POST['prange']; $price1 = $_POST['pprice']; $price = (int)$price1; if ($productname == "" || $range == "" || $price == "" ) { $errorMessage .= "Please fill in all text boxes"; } else { $errorMessage = ""; } $query = "UPDATE products SET product_name = '$productname', product_range = '$range', product_price = '$price' WHERE product_id = '$product_id'"; $result = mysql_query($query); print "<br> $productname from range $range with a price of $price has been updated!"; } ?> Thank you in advance! Hey guys, i'm making an edit feature on my website so i can delete,edit or add more jobs, so far i've made the delete and add function's work however i can't seem to get the edit to work This is the edit function Code: [Select] if ($action == "edit"){ print("<strong>Editing a Job:</strong>"); $editid = $_GET['editid']; $s = 'SELECT * FROM jobs WHERE id="$editid"'; $sql = mysql_query($s) or die ('Error: '.mysql_error () . " IN $s"); while ($row = mysql_fetch_array($sql)) { $id = $row['id']; $job_title = $row['job_title']; $job_description = $row['job_description']; $job_type = $row['job_type']; $job_area = $row['job_area']; $query2 = "UPDATE jobs SET (job_title, job_description, job_type, job_area, hot_job) VALUES ('$job_title', '$job_description', '$job_type', '$job_area', '$hot') WHERE id=$id"; echo("<form name='add' method='post' action='?action=edit'>"); echo("<input type='hidden' name='?action=edit'>"); echo("<table class=main cellspacing=0 cellpadding=5 width=50%>"); echo("<tr><td>Job Title: </td><td align='right'><input type='text' size=50 name='job_title' value='$job_title'></td></tr>"); echo("<tr><td>Job Description: </td><td align='right'><textarea size=50 name='job_description'>$job_description</textarea></td></tr>"); echo("<tr><td>Job Type: </td><td align='center'><select name='job_type'><option>Permanent</option><option>Locum or Contract</option></SELECT></td></tr>"); echo("<tr><td>Hot Job? </td><td align='center'>Yes <input type='radio' name='hot' value='Yes'> No <input type='radio' name='hot' value='no'></td></tr>"); echo("<tr><td>Job Area: </td><td align='center'><select name='job_area'><option>East Anglia</option><option>All UK</option><option>London / South East</option><option>Midlands</option><option>North West</option><option>Northern Ireland</option><option>Scotland</option><option>South</option><option>South West</option><option>Southern Ireland</option><option>Wales</option><option>Yorkshire / North East</option></SELECT></td></tr>"); echo("<tr><td></td><td><div align='right'><input type='Submit'></div></td></tr>"); echo("</table>"); } Here is the whole code, Code: [Select] <?php include'modules/sides/header.php'; ?> <table cellpadding="0" cellspacing="0" width="100%" id="mainTable"> <tr> <td class="left"> <?php include'modules/sides/left.php';?> </td> <td id="centercolumn"> <table class="cont" cellspacing="0"> <tr> <td id="centerCcolumn"> <div class="block"> <?php if(session_is_registered('username')){ if ($userlevel = 3){ ?> <div class="blockTitle">Administration - Add/Remove Jobs</div> <div class="blockContent"> <?php $action = $_GET["action"]; if ($action == "delete"){ $delid = $_GET['delid']; $query = "DELETE FROM jobs WHERE id=".$delid." LIMIT 1"; $sql = mysql_query($query); echo("Job succesfully deleted! [ <a href='add_jobs.php'>Back</a> ]"); } if ($action == "edit"){ print("<strong>Editing a Job:</strong>"); $editid = $_GET['editid']; $s = 'SELECT * FROM jobs WHERE id="$editid"'; $sql = mysql_query($s) or die ('Error: '.mysql_error () . " IN $s"); while ($row = mysql_fetch_array($sql)) { $id = $row['id']; $job_title = $row['job_title']; $job_description = $row['job_description']; $job_type = $row['job_type']; $job_area = $row['job_area']; $query2 = "UPDATE jobs SET (job_title, job_description, job_type, job_area, hot_job) VALUES ('$job_title', '$job_description', '$job_type', '$job_area', '$hot') WHERE id=$id"; echo("<form name='add' method='post' action='?action=edit'>"); echo("<input type='hidden' name='?action=edit'>"); echo("<table class=main cellspacing=0 cellpadding=5 width=50%>"); echo("<tr><td>Job Title: </td><td align='right'><input type='text' size=50 name='job_title' value='$job_title'></td></tr>"); echo("<tr><td>Job Description: </td><td align='right'><textarea size=50 name='job_description'>$job_description</textarea></td></tr>"); echo("<tr><td>Job Type: </td><td align='center'><select name='job_type'><option>Permanent</option><option>Locum or Contract</option></SELECT></td></tr>"); echo("<tr><td>Hot Job? </td><td align='center'>Yes <input type='radio' name='hot' value='Yes'> No <input type='radio' name='hot' value='no'></td></tr>"); echo("<tr><td>Job Area: </td><td align='center'><select name='job_area'><option>East Anglia</option><option>All UK</option><option>London / South East</option><option>Midlands</option><option>North West</option><option>Northern Ireland</option><option>Scotland</option><option>South</option><option>South West</option><option>Southern Ireland</option><option>Wales</option><option>Yorkshire / North East</option></SELECT></td></tr>"); echo("<tr><td></td><td><div align='right'><input type='Submit'></div></td></tr>"); echo("</table>"); } } if ($action == "add"){ $add = $_POST['add']; $job_title = $_POST['job_title']; $job_description = $_POST['job_description']; $job_type = $_POST['job_type']; $job_area = $_POST['job_area']; $hot = $_POST['hot']; $id = mysql_insert_id(); $query = "INSERT INTO jobs (id, job_title, job_description, job_type, job_area, hot_job) VALUES ('$id', '$job_title', '$job_description', '$job_type', '$job_area', '$hot')"; $sql = mysql_query($query) or die (mysql_error()); } print("<strong>Add A New Job!</strong>"); print("<br />"); print("<br />"); echo("<form name='add' method='post' action='?action=add'>"); echo("<input type='hidden' name='?action=add'>"); echo("<table class=main cellspacing=0 cellpadding=5 width=50%>"); echo("<tr><td>Job Title: </td><td align='right'><input type='text' size=50 name='job_title'></td></tr>"); echo("<tr><td>Job Description: </td><td align='right'><textarea size=50 name='job_description'></textarea></td></tr>"); echo("<tr><td>Job Type: </td><td align='center'><select name='job_type'><option>Permanent</option><option>Locum or Contract</option></SELECT></td></tr>"); echo("<tr><td>Hot Job? </td><td align='center'>Yes <input type='radio' name='hot' value='Yes'> No <input type='radio' name='hot' value='no' checked></td></tr>"); echo("<tr><td>Job Area: </td><td align='center'><select name='job_area'><option>East Anglia</option><option>All UK</option><option>London / South East</option><option>Midlands</option><option>North West</option><option>Northern Ireland</option><option>Scotland</option><option>South</option><option>South West</option><option>Southern Ireland</option><option>Wales</option><option>Yorkshire / North East</option></SELECT></td></tr>"); echo("<tr><td></td><td><div align='right'><input type='Submit'></div></td></tr>"); echo("</table>"); if($success == TRUE) { print("<strong>Success!</strong>"); } echo("<br>"); echo("</form>"); print("<strong>Existing Jobs:</strong>"); print("<br />"); print("<br />"); echo("<table class=main cellspacing=0 cellpadding=5>"); echo("<td>ID:</td><td>Title:</td><td>Description:</td><td>Type:</td><td>Area:</td><td>Edit (DO NOT USE YET):</td><td>Delete:</td>"); $query = "SELECT * FROM jobs WHERE 1=1"; $sql = mysql_query($query); while ($row = mysql_fetch_array($sql)) { $id = $row['id']; $job_title = $row['job_title']; $job_description = $row['job_description']; $job_type = $row['job_type']; $job_area = $row['job_area']; $position=18; $job_description2 = substr($job_description, 0, $position); echo("<tr><td><strong>$id</strong></td><td><strong>$job_title</strong></td><td><strong>$job_description2...</strong></td><td><strong>$job_type</strong></td><td><strong>$job_area</strong></td><td><a href='add_jobs.php?action=edit&editid=$id'>Edit</a></td><td><a href='add_jobs.php?action=delete&delid=$id'>Delete</a></td></tr>"); } ?></p></table> </div> </div> <?php }else{echo'Stop hacking';}}?> </td> </tr> </table> <td class="right"> <?php include"modules/sides/right.php"; ?> </td> </tr> </table> <?php include'modules/sides/footer.php';?> Any help would be great, thankyou! hi all, i have a page which lists all of my registered users from the mysql database but i want the ability to edit an account, here is my list users code (just shown the appropiate code and not the rest): Code: [Select] <?php require ('../secure/connect.php'); $sql = "SELECT * FROM users ORDER BY user_level ASC"; $result=mysql_query($sql); echo '<table width="80%" border="0" cellspacing="5" cellpadding="0">'; echo ' <tr> <th><p align="left">User ID:</th> <th><p align="left">User Level:</th> <th><p align="left">Username:</th> <th><p align="left">User Title:</th> <th><p align="left">Email:</th> <th><p align="left">Actions:</th> </tr>'; while($rows=mysql_fetch_array($result)){ ?> <tr> <td><?php echo $rows['userid']; ?></td> <td><?php echo $rows['user_level']; ?></td> <td><?php echo $rows['username']; ?></td> <td><?php echo $rows['user_title']; ?></td> <td><?php echo $rows['email']; ?></td> <td><a href="edit_account.php?id=">Edit Account</a></td> </tr> <?php } ?> this lists my users nicely, as you can see i put it a edit account action at the end with a empty id= because that may be a way of doing it but im not sure what else to do or if there is a better way of doing it. any help would be great! guys in this code i get some data from myswl table and i display them in to and html table with dynamic textboxes the first part works ok but how can i update the mysqltable with tha changes? i have try to work with one table and i get an error Notice: Undefined index: name1 in D:\....... <?php session_start(); include($_SERVER['DOCUMENT_ROOT'].'/includes/connection.php'); $result = mysql_query( "SELECT * FROM serv " ); while($row = mysql_fetch_array($result, MYSQL_ASSOC)) { echo "<tr>"; echo "<td ALIGN=\"center\"><form method='POST'><input name=\"name1\" type=\"text\" value={$row['onoma-eponymo']} id=\"n1\" STYLE=\" border-color:black; border-style:none; border-width:1px; font-size:30pt; color:yellow; background-color:gray; \" size=\"25\" maxlength=\"24\" /></form></td>"; echo "<td ALIGN=\"center\"><form method='POST'><input name=\"name2\" type=\"text\" value={$row['username']} STYLE=\" border-color:black; border-style:none; border-width:1px; font-size:30pt; color:yellow; background-color:gray; \" size=\"7\" maxlength=\"5\" /></form></td>"; echo "<td ALIGN=\"center\"><form method='POST'><input name=\"name3\" type=\"text\" value={$row['password']} STYLE=\" border-color:black; border-style:none; border-width:1px; font-size:30pt; color:yellow; background-color:gray; \" size=\"7\" maxlength=\"5\" /></form></td>"; echo "<td ALIGN=\"center\"><form method='POST'><input name=\"name4\" type=\"text\" value={$row['serv_id']} STYLE=\" border-color:black; border-style:none; border-width:1px; font-size:30pt; color:yellow; background-color:gray; \" size=\"9\" maxlength=\"15\" /></form></td>"; echo "</tr>\n"; } echo "</table>"; if(isset($_POST['back'])) {header("location:admin.php");} if(isset($_POST['sub_update'])) { $text = $_POST["name1"]; mysql_query("INSERT INTO serv (password) VALUES ('$text') "); } ?> <body> <form method="post" action=""> <input type="Submit" name="sub_update" value="Ενημέρωση Αλλαγών"style="height:6em; width:16em; font-size:150%;"> <form method="post" action=""> <input type="Submit" name="back" value="Back"style="height:6em; width:16em; font-size:150%;"> </form> ok I have text files with my logins to my emails and such.. Well I have this script to prepare the logins for another script the files with the logins are in this format email pass email pass email pass email pass $filename = 'text.txt'; $file = file($filename); $begin = "$"; foreach($file as $b){ list($email,$password) = explode(" ",$b); $emails[] = $begin."header[]=get_header('".$email."','".$password."');";} file_put_contents($filename,implode($emails)); echo "Text file edited"; sleep(5); Is what I am using to get the email and password in this format $header[]=get_header('email','pass'); but it is putting it like this $header[]=get_header('email','pass '); $header[]=get_header('email','pass '); $header[]=get_header('email','pass '); $header[]=get_header('email','pass '); $header[]=get_header('email','pass Why is it putting '); on a new line? I need it to be right behind the password so it looks like this $header[]=get_header('email','pass'); $header[]=get_header('email','pass'); $header[]=get_header('email','pass'); $header[]=get_header('email','pass'); $header[]=get_header('email','pass'); any ideas? Thanks |