Jump to content

newtoall

Members
  • Posts

    17
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

newtoall's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Cheers, I am having a bit of troble with the Could you please point me in the direction of an example?
  2. I have the following drop down in a for that is populated from an array: $yearnum = array('2006','2007','2008','2009'); Is it possible to set up an initial value for the drop list, say 2007. Any help would be much appreciated!! <td width="109"><font size="2" face="Arial, Helvetica, sans-serif">Select Year: </td> <td width="88"> <select name="yearnum" id="yearnum" onchange="xajax_addWeeks('weeks',document.form1.yearnum.value)"> <option value="">--select--</option> <? foreach ($yearnum as $mod) { ?> <option value="<?= $mod?>"><?= $mod?></option> <? } ?> </select> </td> [/icode]
  3. yes $desc = $desc.$obj->pdesc.chr(13)."<br>"; worked just fine - cheers.
  4. Please help!! I have a querry that returns a number of values the following code cats them together: while ($obj = $result->fetch_object()) { $desc = $desc.$obj->pdesc.chr(13); } unfortunatly the chr(13) does not produces a line break between values as I expected. So........ how can this bit of code be changed to include a line break??
  5. sasa you are an absolute star, thank you so much it fixed it -- Nice one!!!!
  6. Hi I have posted this before but I thought I would add a proper example. The following is an example of a form used to display an array which works fine: <?php $shop = array( array("rose", 1.25 , 15), array("daisy", 0.75 , 25), array("orchid", 1.15 , 7) ); $shops = sizeof($shop); ?> <table width="500" border="0" cellspacing="1" cellpadding="0"> <form name="form1" method="post" action="update.php"> <tr> <td> <table width="500" border="0" cellspacing="1" cellpadding="0"> <tr> <td align="center"><strong>select</strong></td> <td align="center"><strong>flower</strong></td> <td align="center"><strong>price</strong></td> <td align="center"><strong>number</strong></td> </tr> <?php for($i = 0; $i<$shops; $i++){ ?> <tr> <td align="center"><input name="name[]" type="text" id="name" value="<?php echo $shop[$i][0]?>" ></td> <td align="center"><input name="lastname[]" type="text" id="age" value="<?php echo $shop[$i][1]?>"></td> <td align="center"><input name="email[]" type="text" id="wife" value="<?php echo $shop[$i][2]?>"></td> </tr> <?php } ?> </table> </td> </tr> </form> </table> However If I try to add a select to this table the 3 rows displayed above no longer show instead I get just 1 row: <?php $shop = array( array("rose", 1.25 , 15), array("daisy", 0.75 , 25), array("orchid", 1.15 , 7) ); $shops = sizeof($shop); ?> <table width="500" border="0" cellspacing="1" cellpadding="0"> <form name="form1" method="post" action="update.php"> <tr> <td> <table width="500" border="0" cellspacing="1" cellpadding="0"> <tr> <td align="center"><strong>select</strong></td> <td align="center"><strong>flower</strong></td> <td align="center"><strong>price</strong></td> <td align="center"><strong>number</strong></td> </tr> <?php for($i = 0; $i<$shops; $i++){ ?> <tr> <td><select name = "PCode[]"> <?php for($i = 0; $i<$shops; $i++) { echo '<option value = '.$shop[$i][0]; if ($shop[$i][0] == $shop[$i][0]) echo ' selected'; echo '>'.$shop[$i][0].'</option>\n'; } ?></select></td> <td align="center"><input name="name[]" type="text" id="name" value="<?php echo $shop[$i][0]?>" ></td> <td align="center"><input name="lastname[]" type="text" id="age" value="<?php echo $shop[$i][1]?>"></td> <td align="center"><input name="email[]" type="text" id="wife" value="<?php echo $shop[$i][2]?>"></td> </tr> <?php } ?> </table> </td> </tr> </form> </table> can anyone advise on how I can get all 3 rows to display with the select in each one??
  7. I have an array being created a number of times with in a loop, before it is created I want to check if it empty and if it isn't then clear it down. How do I do this?? Any help you can provide will help preserve my sanity. Rich. ???
  8. I hope someone who has a bit more PHP knowledgeable than me can explain why the following is happening and suggest a wat to fix it…..: Basically I have a form that contains a table and is used to update information in a mysql database. The form displays multiple rows of information and in the following example seems to work OK (I have chopped the table down a bit): <form name='timesheetForm' method='post' action=''> <table bgcolor='#CCD6E4'> <tr> <tr> <td><font size="2" face="Arial, Helvetica, sans-serif"> Project code</td> <td><font size="2" face="Arial, Helvetica, sans-serif">Monday</td> <td><font size="2" face="Arial, Helvetica, sans-serif">Totals</td> </tr> <td><input type='text' name='ProjectCode[]' value="<?php echo $TimesheetP[$i][0];?>" size=10 maxlength=10></td> <td><input type='text' name='MonTime[]' value="<?php echo $TimesheetP[$i][5];?>" size=10 maxlength=10></td> <td><input type='text' name='TotalTime[]' value="<?php echo $TimesheetP[$i][12];?>" size=10 maxlength=10></td> </tr> <?php } ?> <tr> <td colspan=9 align='right'> <input type='submit' value='Submit Timesheet'></td></tr> </table></form> However when I add a select value into the table only one row is returned, and it looks like the select stops the outer loop from working, I was hoping someone could tell me why??: <form name='timesheetForm' method='post' action=''> <table bgcolor='#CCD6E4'> <tr> <tr> <td><font size="2" face="Arial, Helvetica, sans-serif"> Project code</td> <td><font size="2" face="Arial, Helvetica, sans-serif">Monday</td> <td><font size="2" face="Arial, Helvetica, sans-serif">Totals</td> </tr> <?php for($i = 0; $i<$TimesheetPs; $i++) { ?> <tr> <td><select name = "ProjectCode[]"> <?php for($i = 0; $i<$project_lists; $i++) { echo '<option value = '.$project_list[$i][0]; if ($TimesheetP[$i][0] == $project_list[$i][0]) echo ' selected'; echo '>'.$project_list[$i][1]."</option>\n"; } ?></select></td> <td><input type='text' name='MonTime[]' value="<?php echo $TimesheetP[$i][5];?>" size=10 maxlength=10></td> <td><input type='text' name='TotalTime[]' value="<?php echo $TimesheetP[$i][12];?>" size=10 maxlength=10></td> </tr> <?php } ?> <tr> <td colspan=9 align='right'> <input type='submit' value='Submit Timesheet'></td></tr> </table></form> Any help would be appreciated.
  9. Cheers, slotted this in but the form is still only one row is returned. I have been looking a bit further and it looks like the inner select code causes the outer loop to stop but I don't know why??
  10. Please help................. Hopefully this is somthing really obvious that I can't see. Below is a form that shows multiple rows depending on the number or records being returned from a database query. This worked fine however I have tried to slot a select item into this dynamic form and now only one row is show on the webpage where there should be 6. Is it possible to slot a select item into a form? if so what am I doing wrong? Any help would be great I am still new to PHP and learning as I go! <form name='timesheetForm' method='post' action=''> <table bgcolor='#CCD6E4'> <tr> <tr> <td><font size="2" face="Arial, Helvetica, sans-serif"> Project code</td> <td><font size="2" face="Arial, Helvetica, sans-serif">Monday</td> <td><font size="2" face="Arial, Helvetica, sans-serif">Tuesday</td> <td><font size="2" face="Arial, Helvetica, sans-serif">Wednesday</td> <td><font size="2" face="Arial, Helvetica, sans-serif">Thursday</td> <td><font size="2" face="Arial, Helvetica, sans-serif">Friday</td> <td><font size="2" face="Arial, Helvetica, sans-serif">Saturday</td> <td><font size="2" face="Arial, Helvetica, sans-serif">Sunday</td> <td><font size="2" face="Arial, Helvetica, sans-serif">Totals</td> </tr> <?php for($i = 0; $i<$TimesheetPs; $i++) { ?> <tr> <td><select name = "PCode[]"> <?php for($i = 0; $i<$project_lists; $i++) { echo '<option value = '.$project_list[$i][0]; if ($TimesheetP[$i][0] == $project_list[$i][0]) echo ' selected'; echo '>'.$project_list[$i][1]."</option>\n"; } ?></select></td> <td><input type='text' name='MonTime[]' value="<?php echo $TimesheetP[$i][5];?>" size=10 maxlength=10></td> <td><input type='text' name='TueTime[]' value="<?php echo $TimesheetP[$i][6];?>" size=10 maxlength=10></td> <td><input type='text' name='WedTime[]' value="<?php echo $TimesheetP[$i][7];?>" size=10 maxlength=10></td> <td><input type='text' name='ThuTime[]' value="<?php echo $TimesheetP[$i][8];?>" size=10 maxlength=10></td> <td><input type='text' name='FriTime[]' value="<?php echo $TimesheetP[$i][9];?>" size=10 maxlength=10></td> <td><input type='text' name='SatTime[]' value="<?php echo $TimesheetP[$i][10];?>" size=10 maxlength=10></td> <td><input type='text' name='SunTime[]' value="<?php echo $TimesheetP[$i][11];?>" size=10 maxlength=10></td> <td><input type='text' name='TotalTime[]' value="<?php echo $TimesheetP[$i][12];?>" size=10 maxlength=10></td> <td><input type='hidden' name='WeekID[]' value="<?php echo $TimesheetP[$i][4];?>" size=10 maxlength=10></td> <td><input type='hidden' name='ProjectD[]' value="<?php echo $TimesheetP[$i][3];?>" size=10 maxlength=10></td> <td><input type='hidden' name='ProjectID[]' value="<?php echo $TimesheetP[$i][0];?>" size=10 maxlength=10></td> <td><input type='hidden' name='WeekID[]' value="<?php echo $TimesheetP[$i][12];?>" size=10 maxlength=10></td> <td><input type='hidden' name='StatusCode[]' value="<?php echo $TimesheetP[$i][11];?>" size=10 maxlength=10></td> </tr> <?php } ?> <tr> <td colspan=9 align='right'> <input type='submit' value='Submit Timesheet'></td></tr> </table></form>
  11. Ajax is indeed what I wanted!! Cheers for the link.
  12. Hi, Short question: Is it possible to have a php form that will be automatically populated when a user selects a value from a drop down list item. Description: I have am writting a php form that will be used to update information that already exisits on a mysql database. I have set up two forms on one screen one contains a drop down list of people names and a 'get details' button. This form basically passes the id of the person the user selects on this first form back into the screen and is used by the second form to populate each field: value="<?php echo retrive_person($person_id)->FIRST_NAME;?>" Rather than having two forms is it possible to have one form with the fields being populate as soon as the details of the person the user selects from the drop down list. Any help would be appreciated!
  13. If i wanted to check two things in a if statement with out using an elsif how would I do in. for example: if ((!$result) || ($result->num_rows=0)) {do stuff} does not work, what is the best may of doing this in PHP? Hope you can help!
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.