Jump to content

PHP_Idiot

Members
  • Posts

    131
  • Joined

  • Last visited

Everything posted by PHP_Idiot

  1. Thank you so much for the help, I've had to make a minor change but it works a treat now, heres what I have now: <?php // Make a MySQL Connection mysql_connect("localhost", "myusername", "mypassword") or die(mysql_error()); mysql_select_db("myDB") or die(mysql_error()); //mySQL queries $query = "SELECT SUM(Position.Points), Player.FirstName, Player.LastName FROM Position, Player, Results, Venue WHERE Player.MembershipNo=Results.MembershipNo AND Results.Position=Position.Position AND Venue.VenueID = Results.VenueID GROUP BY Player.FirstName ORDER BY SUM(Position.Points) DESC"; $result=mysql_query($query) or die ("couldn't execute query"); echo <<<html <table border="0" width="400" cellpadding="2" cellspacing="1"> <tr> <td>First Name</td> <td>Last Name</td> <td>SUM</td> </tr> html; //Now start the loop. while($r = mysql_fetch_array($result)){ //and echo each new row echo <<<html <tr> <td>{$r['FirstName']}</td> <td>{$r['LastName']}</td> <td>{$r['SUM(Position.Points)']}</td> </tr> html; } //And close the table. echo "</table>"; ?> Thank you so much for all the help, you have no idea how big my grin is right now tytytytyty
  2. I hope this is in the right place! I have the following query: SELECT SUM(Position.Points), Player.FirstName, Player.LastName FROM Position, Player, Results, Venue WHERE Player.MembershipNo=Results.MembershipNo AND Results.Position=Position.Position AND Venue.VenueID = Results.VenueID GROUP BY Player.FirstName ORDER BY SUM(Position.Points) DESC Which works and shows the results I need, but I'm stuggling to display it properly. I need a dynamic table that is three columns wide (FirstName, LastName, SUM(Position.Points)) and as many rows long as is required. I know I can use a simple loop to define number of rows, but I'm really struggling to get any of it to work! I can establish a connection and run the query, but can't figure out how to extract the data stored in $result. I know this is probably pretty simple but after spending all afternoon searching the web and trying various things, I'm getting now where fast!
  3. LOL That makes perfect sense, but I changed the name, which also worked, however, I prefer the 'correct' method as you described so will change it back My next job it to work out how to put a sum() in there as well!! Thanks a lot for all you help, it's really appreciated.
  4. Thats awesome thanks, it gives me a much clearer idea as to what I need to try to do, unfortunately you example throws up the following error: #1052 - Column 'MembershipNo' in where clause is ambiguous Is that because both collumn names are identical? I might try changing them fractionally to see if that helps. Some home work for me to do tomorrow :-) Thanks a million shlumph
  5. Hi shlumph, I've been looking at both UNION and JOIN, but I think your right JOIN is the way to go, I've never used it before and although I can get some success in joining 2 tables I'm struggling to join more than 2. I'm especially having difficulty with creating a SUM(Points) to total a players points across a particular venue. I would be really gratefull If you could give me an example based on my tables, it would help me see where I'm going wrong and also help me learn how to use it in other situations I need to solve. (I know it's a big ask, but this is a giant leap outside my comfort zone in mysql!) Many Thanks
  6. Hi Firstly thanks for even reading this, secondly I'm new to mysql so this might sem a dumb question to you pros out there. I have 4 tables Players MembershipNo, FirstName, LastName, Town, Email Venue VenueID, VenueName, Address1, Address2, Town, County, Postcode, TelNo, FaxNo, Email, Web, GameNight1, GameTime1, GameNight2, GameTime2, ContactFirstName, ContactLastName, ContactMobile Results ResultID, VenueID, MembershipNo, Position Position Position, Points The first Column Names in each above is the PrimaryKey. What I need to do is create queries that will: [*]Search all points earnt for a given MembershipNo [*]View Finishing poisitions for all players (membershipNo, FirstName, LastName) for a given Venue on a given Date [*]Search total Points earnt for all Players (creating a leader Board) I understand how to do a basic Select to pull all or specific data from a table and sort it, but these cross tables, and although I have search for examples and found some I can't get any to actually work. If anyone could show me how I wold be eternally grateful. Many Thanks
  7. No need to apologise. Learnt another several new things today, I just sometimes get the feeling I'm learning them in the wrong order...ah well sire MUST be live by tuesday so it's a 'good enough, move on' strategy at the moment. One day I'll get time to straighten things out and learn the 'right' way to do it
  8. Yes thanks for that jackpf, I did add it and as I said nothing was reported. Then I re-read the manual and realised I'd added it incorrectly ran it again it found the problem (a really obvious one too) and it's now all fixed I'd love to be all miffed at you for your not so polite initial response...but you were correct and I as the name suggests am a php idiot... but learning (not exactely fast, but learning non the less). Thanks for all the responses it is finally working :D
  9. unfortunately changing the 'Null' to Null didn't help in getting it into the DB, although it was still a valid comment so thanks for pointing it out. Can you see any other reason why it wouldn't work! PS There is no reported error message jackpf
  10. Can anyone spot the error here? The connection is open, and the Print statement shows me that everything is there, but it won't upload to the database. Would be really gratefull for a solution. for ($PN = 1; $PN <= $_POST['PlayerNo']; $PN++) { ${"MembershipNo$PN"} = $_POST["MembershipNo$PN"]; ${"Position$PN"} = $_POST["Position$PN"]; $query2 = "INSERT into Results values (`ResultID`, `VenueID`, `MembershipNo`, `Date`, `Position`) VALUES('NULL', '$Venue', '${"MembershipNo$PN"}', '$Date', '${"Position$PN"}')"; $result = mysql_query($con, $db, $query2); print("$query2"); }
  11. I'd love to...the page code is below, as for DB schema...eh! how do I do that? Heres the code, but I've tried so many things to get it working I think I broke it again!! <!DOCTYPE HTML PUBLIC "-//SoftQuad//DTD HoTMetaL PRO 5.0::19981022::extensions to HTML 4.0//EN" "hmpro5.dtd"> <html> <head> <?php //set variables from form fields $Day = $_POST['Day']; $Month = $_POST['Month']; $Year = $_POST['Year']; $Venue = $_POST['Venue']; $PlayerNo = $_POST['PlayerNo']; $beensubmited = $_POST['beensubmited']; $table = "Player"; $table2 = "Results"; $Date = $_POST['Date']; for ($PN = 1; $PN <= $_POST['PlayerNo']; $PN++) { ${"MembershipNo$PN"} = $_POST["MembershipNo$PN"]; } /* Data for SQL-server */ $host= "localhost"; /* Address of database server */ $user= "benn"; /* FTP-username */ $password= "86gh44bn"; /* FTP-Password */ $database= "gbpokerclub_benn"; /* name of database */ /* Accessing SQL-Server and querying table */ $con = MYSQL_CONNECT($host, $user, $password) or die ( "<H3>Server unreachable</H3>"); $db = MYSQL_SELECT_DB($database) or die ( "<H3>Database non existent</H3>"); //mySQL queries $query = MYSQL_QUERY("SELECT * FROM $table"); $query2 = "INSERT into $table2 values (`ResultID`, `VenueID`, `MembershipNo`, `Date`, `Position`) VALUES('NULL', '$Venue', '${"MembershipNo$PN"}', '$Date', '$Position')"; //Javascript stuff print("<SCRIPT type=\"text/javascript\"> function showFN(ID, FNnum, LNnum) { "); while($row = mysql_fetch_row($query)) { print(" if (ID =='$row[0]') {document.getElementById(FNnum).value='$row[1]'; document.getElementById(LNnum).value='$row[3]'; } else "); //php end print } //php end while print("{document.getElementById(FNnum).value='ID Not In Database';} } </SCRIPT>"); ?> <title>GB Poker Club - Admin Area</title> </head> <body> <h1>Tournament Details</h1> <?php //top form copies over venue details BEFORE SUBMITTING if($beensubmited ==""){ echo '<table border="1" cellspacing="0" bgcolor="lightgrey" bordercolor="darkgrey">'; echo '<caption align="left"><h3>Venue Details</h3></caption>'; echo "<tr><th>Venue</th><th>Date</th><th>Number of Players</th></tr>"; echo "<tr><td align='center' valign='center'>"; echo "$Venue"; echo "</td><td align='center' valign='center'>"; echo "$Day / $Month / $Year"; echo "</td><td align='center' valign='center'>"; echo "$PlayerNo"; echo "</td></tr></table>"; echo '<br>'; //create Points array per player $pointsArray = array( 1 => 500, 2 => 350, 3 => 250, 4 => 200, 5 => 150, 6 => 100, 7 => 75, 8 => 50, ); //creates hidden form! print("<form name=\"userform\" method=\"POST\" action=\"createform4.php\"> <table border=\"1\" cellspacing=\"0\" bgcolor=\"lightgrey\" bordercolor=\"darkgrey\" align=\"left\"> <caption align=\"left\"><h3>Venue Results</h3></caption> <tr><th>Position</th> <th>Points</th><th>Membership Number</th><th>First Name</th><th>Last Name</th></tr> <input name=\"Venue\" type=\"hidden\" value=\"$Venue\"> <input name=\"Date\" type=\"hidden\" value=\"$Year-$Month-$Day\"> <input name=\"Date\" type=\"hidden\" value=\"$Year-$Month-$Day\"> <input name=\"PlayerNo\" type=\"hidden\" value=\"$PlayerNo\"> <input name=\"beensubmited\" type=\"hidden\" value=\"Y\">"); //Creates counter to name individual cells for ( $counter = 1; $counter <= $PlayerNo; $counter += 1) { $points = isset($pointsArray[$counter]) ? $pointsArray[$counter] : 25; ; //produces querys form print("<tr><td align=\"center\" valign=\"center\"> $counter</td><td align=\"center\" valign=\"center\"> $points</td><td align=\"center\" valign=\"center\"> <input name=\"Position$counter\" value=\"$counter\" type=\"text\" size=\"15\" maxlength=\"7\" READONLY=\"READONLY\"> <input name=\"MembershipNo$counter\" type=\"text\" size=\"7\" maxlength=\"7\" tabindex=\"$counter\"onChange=\"showFN(this.value, 'FirstName$counter', 'LastName$counter');\"> </td><td align=\"center\" valign=\"center\"> <input name=\"FirstName$counter\" type=\"text\" size=\"15\" maxlength=\"7\" READONLY=\"READONLY\"> </td><td align=\"center\" valign=\"center\"> <input name=\"LastName$counter\" type=\"text\" size=\"15\" maxlength=\"7\" READONLY=\"READONLY\"> </td></tr>"); } //submit Button print("</table><br> <input type=SUBMIT name=action value=\"Done!\"> </form>"); } // end beensubmited blank // Adds form data to DB AFTER SUBMITTING if($beensubmited =="Y"){ $Venue = $_POST['Venue']; $Date = $_POST['Date']; $PlayerNo = $_POST['PlayerNo']; $PlayerNo = $_POST['PlayerNo']; //MYSQL_CONNECT($server, $user, $password) or die ( "<H3>Server unreachable</H3>"); //MYSQL_SELECT_DB($database) or die ( "<H3>Database non existent</H3>"); foreach($_POST as $k=>$v) $$k=$v; for ($PN = 1; $PN <= $_POST['PlayerNo']; $PN++) { ${"MembershipNo$PN"} = $_POST["MembershipNo$PN"]; $result2 = "INSERT into $table2 values (`ResultID`, `VenueID`, `MembershipNo`, `Date`, `Position`) VALUES('NULL', '$Venue', '${"MembershipNo$PN"}', '$Date', '$Position')"; //mysql_db_query ($database, $result2, $link); print("$result2"); /*if($beensubmited =="Y") { $Venue = $_POST['Venue']; $Date = $_POST['Date']; $PlayerNo = $_POST['PlayerNo']; $PlayerNo = $_POST['PlayerNo']; // Connect $link = mysql_connect($host, $user, $password) OR die(mysql_error()); if (!$link) { die('Could not connect: ' . mysql_error()); } echo 'Connected successfully'; foreach($_POST as $k=>$v) $$k=$v; for ($PN = 1; $PN <= $_POST['PlayerNo']; $PN++) { ${"MembershipNo$PN"} = $_POST["MembershipNo$PN"]; // Query $query3 = "INSERT into $table2 values (`ResultID`, `VenueID`, `MembershipNo`, `Date`, `Position`) VALUES('NULL', '$Venue', '${"MembershipNo$PN"}', '$Date', '$Position')"; $result = mysql_query($query3); } print("$query2"); } //end been submitted YES } } ?> <!-- Script Size: 0.53 KB --> </body> </html>
  12. A fair point... I had before but it made no sense, so I revisited it. This time it made more sense anmd I came up with: if($beensubmited =="Y") { // Connect $link = mysql_connect($host, $user, $password) OR die(mysql_error()); if (!$link) { die('Could not connect: ' . mysql_error()); } echo 'Connected successfully'; // Query $query3 = "INSERT into $table2 values (`ResultID`, `VenueID`, `MembershipNo`, `Date`, `Position`) VALUES('NULL', '$Venue', '${"MembershipNo$PN"}', '$Date', '$Position')"; $result = mysql_query($query3); } Now I get a nice little message saying Connected successfully, but still nothing is being loaded into the DB!? I've tried honestly, in fact i've been at this for nearly 12hours now!!! I'm new to php and this is driving me freaking nuts, I'm prepared to beg for help if it makes any difference?
  13. Ok I assigned them to variables as you suggested and included them at the end in this statement: foreach($_POST as $k=>$v) $$k=$v; { $result = mysql_query($con, $db, $query2) or die ("couldn't do it!"); print("$query2"); } But all I get is the results of the Print("query2"); but nothing is uploaded! Any other ideas? (pretty please)
  14. The below is the entire code for a page on my site, it should record info via a form then post the saved data back to the database. The form works, the results record the connection is made but nothing uploads to the DB. I've spent all day trying to work it out and got no where, I've had friends look at it and they can't see the problem either. Please help! <!DOCTYPE HTML PUBLIC "-//SoftQuad//DTD HoTMetaL PRO 5.0::19981022::extensions to HTML 4.0//EN" "hmpro5.dtd"> <html> <head> <?php //set variables from form fields $Day = $_POST['Day']; $Month = $_POST['Month']; $Year = $_POST['Year']; $Venue = $_POST['Venue']; $PlayerNo = $_POST['PlayerNo']; $beensubmited = $_POST['beensubmited']; $table = "Player"; $table2 = "Results"; for ($PN = 1; $PN <= $_POST['PlayerNo']; $PN++) { ${"MembershipNo$PN"} = $_POST["MembershipNo$PN"]; } /* Data for SQL-server */ $host= "localhost"; /* Address of database server */ $user= "XXXX"; /* FTP-username */ $password= "XXXX"; /* FTP-Password */ $database= "XXXX"; /* name of database */ /* Accessing SQL-Server and querying table */ MYSQL_CONNECT($host, $user, $password) or die ( "<H3>Server unreachable</H3>"); MYSQL_SELECT_DB($database) or die ( "<H3>Database non existent</H3>"); //mySQL queries $query = MYSQL_QUERY("SELECT * FROM $table"); $query2 = "INSERT into $table2 values (`ResultID`, `VenueID`, `MembershipNo`, `Date`, `Position`) VALUES('NULL', '$Venue', '${"MembershipNo$PN"}', '$Date', '$Position')"; //Javascript stuff print("<SCRIPT type=\"text/javascript\"> function showFN(ID, FNnum, LNnum) { "); while($row = mysql_fetch_row($query)) { print(" if (ID =='$row[0]') {document.getElementById(FNnum).value='$row[1]'; document.getElementById(LNnum).value='$row[3]'; } else "); //php end print } //php end while print("{document.getElementById(FNnum).value='ID Not In Database';} } </SCRIPT>"); ?> <title>GB Poker Club - Admin Area</title> </head> <body> <h1>Tournament Details</h1> <?php //top form copies over venue details BEFORE SUBMITTING if($beensubmited ==""){ echo '<table border="1" cellspacing="0" bgcolor="lightgrey" bordercolor="darkgrey">'; echo '<caption align="left"><h3>Venue Details</h3></caption>'; echo "<tr><th>Venue</th><th>Date</th><th>Number of Players</th></tr>"; echo "<tr><td align='center' valign='center'>"; echo "$Venue"; echo "</td><td align='center' valign='center'>"; echo "$Day / $Month / $Year"; echo "</td><td align='center' valign='center'>"; echo "$PlayerNo"; echo "</td></tr></table>"; echo '<br>'; //create Points array per player $pointsArray = array( 1 => 500, 2 => 350, 3 => 250, 4 => 200, 5 => 150, 6 => 100, 7 => 75, 8 => 50, ); //creates hidden form! print("<form name=\"userform\" method=\"POST\" action=\"createform3.php\"> <table border=\"1\" cellspacing=\"0\" bgcolor=\"lightgrey\" bordercolor=\"darkgrey\" align=\"left\"> <caption align=\"left\"><h3>Venue Results</h3></caption> <tr><th>Position</th> <th>Points</th><th>Membership Number</th><th>First Name</th><th>Last Name</th></tr> <input name=\"Venue\" type=\"hidden\" value=\"$Venue\"> <input name=\"Date\" type=\"hidden\" value=\"$Year-$Month-$Day\"> <input name=\"Date\" type=\"hidden\" value=\"$Year-$Month-$Day\"> <input name=\"PlayerNo\" type=\"hidden\" value=\"$PlayerNo\"> <input name=\"beensubmited\" type=\"hidden\" value=\"Y\">"); //Creates counter to name individual cells for ( $counter = 1; $counter <= $PlayerNo; $counter += 1) { $points = isset($pointsArray[$counter]) ? $pointsArray[$counter] : 25; ; //produces querys form print("<tr><td align=\"center\" valign=\"center\"> $counter</td><td align=\"center\" valign=\"center\"> $points</td><td align=\"center\" valign=\"center\"> <input name=\"Position$counter\" type=\"hidden\" value=\"$counter\"> <input name=\"MembershipNo$counter\" type=\"text\" size=\"7\" maxlength=\"7\" tabindex=\"$counter\"onChange=\"showFN(this.value, 'FirstName$counter', 'LastName$counter');\"> </td><td align=\"center\" valign=\"center\"> <input name=\"FirstName$counter\" type=\"text\" size=\"15\" maxlength=\"7\" READONLY=\"READONLY\"> </td><td align=\"center\" valign=\"center\"> <input name=\"LastName$counter\" type=\"text\" size=\"15\" maxlength=\"7\" READONLY=\"READONLY\"> </td></tr>"); } //submit Button print("</table><br> <input type=SUBMIT name=action value=\"Done!\"> </form>"); } // end beensubmited blank // Adds form data to DB AFTER SUBMITTING if($beensubmited =="Y"){ foreach($_POST as $k=>$v) $$k=$v; { //mysql_db_query ($database, $query2, $link); $result = mysql_query($query2) or die ("couldn't do it!"); print("$query2"); } } ?> <!-- Script Size: 0.53 KB --> </body> </html>
  15. Thanks so much for explaining in more detail, I tried it with the preg_replace (just because it makes more sense to my simple brain!) But when I ran the following at the end to check the output, it still had the Venue name as well as the ID! foreach($_POST as $field => $value) { echo "$field, $value<br>"; } Unfortunately my server seems to have gone to bed, as I have no connection at the moment so can't test anything else out, I think I'll give up for tonight and try again in the morning. Thanks so much for all the help I really appreciate it, I'll drop a note in tomorrow if I manage to get it going
  16. Oh ok, never heard of preg_match before! I tried to use it like this: if ($_POST["Venue$i"] == '') { ${"Venue$i"} = "<span style=\"color:red;\">Venue$i omitted.</span>"; } else { ${"Venue$i"} = preg_match('@.*?\((\d*)\)@',$_POST["Venue{$i}"],$match); ${"Venue$i"}=$match[1]; } but got no results. Then went and read up on it on the manual website, but I can't see how this will work in place of ereg-replace!
  17. One day I'll make it a mission to understand all this!! But for now I'm happy just to have it working!! I really appreciate you taking the time to explain it, and I kinda get it, but I need to play with it some more to fully understand. Can I ask you one more question though please... if ($_POST["Venue$i"] == '') { ${"Venue$i"} = "<span style=\"color:red;\">Venue$i omitted.</span>"; } else { ${"Venue$i"} = ereg_replace("[A-Za-z)(.-]","",$_POST["Venue$i"]; } This code doesn't work, if I remove the -- ereg_replace("[A-Za-z)(.-]","", -- bit it does. Where am I going wrong? The reason I'm doing this is that the VenueName stores the ID as well, this is the format: Venue Name(12) I want to strip off the text and brackets and spaces -'s and anything else and just be left with the number. This is the VenueID in myDB Table and is the primary key. Any ideas? (Promise this is the last question..probably...for now at least )
  18. Woohoo.........you guys rock!! Thebadbad - correctly assumed I hadn't defined $PlayerNo (it should actually have been $Players) laffin now got your original code running and the below: for ($i = 1; $i <= $Players; $i++) { if ($_POST["MembershipNo$i"] == '') { ${"MembershipNo$i"} = "<span style=\"color:red;\">MembershipNo$i omitted.</span>"; } else { ${"MembershipNo$i"} = $_POST["MembershipNo$i"]; } echo $i; echo "<br>"; echo ${"MembershipNo$i"}; echo "<br>"; } gives me the output I was looking for However... I really like the idea of using the array you posted your last comment, but couldn't get it working! I presume this would do away with having to repeat the above code for each field I wanted to place into variables!
  19. Thank you both for your suggestions. Laffin, When I tried your code I got a fata error on the If line, I probably used it in the wrong way! Sorry i couldn't get it to work! thebadlad your code runs without error, and you correct that I am trying to create a variable for each field name as I need to load the contents of these variables into my database. However, I couldn't echo out the contents of any of the variables! Bascially on the form that is created (MembershipNo1, MembershipNo2 etc) I want to create variables of the same name that stores the contents of those fields. I suspect the code you have given does this, but I don't seem to be able to 'see' the contents to check it is storing what I need. I confess to being a total noob this is my first ever dip into php so please be patient with me, I appreciate the help enourmously! Cheers
  20. I have a FOR Loop that sequentially names form fields based on a user input in the PlayerNo field. The below code snippets should give you the idea. for ( $counter = 1; $counter <= $PlayerNo; $counter += 1) <input name=\"Position$counter\" <input name=\"Points$counter\" <input name=\"MembershipNo$counter\" This works perfectly, but the problem is when I try to get the $_POST data for each field How can I get all the data and have the following also sequentially numbered? if ($_POST['MembershipNo1'] == ' '){ $MembershipNo = '<span style="color:red;">MembershipNo omitted.</span>'; }else{ $MembershipNo = $_POST['MembershipNo1']; } I have tried a few things but I just keep getting errors! Anyone got any ideas? Thanks a lot
  21. So I'll need to use Java AND Ajax!! Hmm, better get learning I know nothing about either!
  22. Confusing title I know, but wasn't sure how else to describe it! I have an html table with 5 columns: Position, Points, MembershipNo, FirstName, LastName Position and Points are populated using a php $counter loop. MembershipNo will be user inputted FirstName & LastName - I want these to look up the membership number that has been inputted and display the associated First & Last names of the players. However, I want it to do this on the fly, so as soon as each membership number is entered the names appear. What I do not want to do is to have to click a button either at the end of each row or at the end of the form to fill these values. I can't work out how to do this, but I suspect it may involve Java (although I desperately hope it doesn't as I have never used it!). Can anyone offer any advice at all please?
  23. Thats perfect thanks a lot I Don't suppose you can help with the next step can you? I need to get the FirstName and LastName cells to up date with the names that correspond to the membership number typed on the same row, Ideally I want this update to occur as soon as the membership number is typed in rather than having to fill them all and click a button to perform the query. The test form can be seen at www.gbpokerclub.co.uk/testform.php, fill this in and hit the create form button and you will see the table I'm talking about. Many Thanks
  24. I have a table that generates rows based on user input and it displays the number of players, and the points earned for each position. then is a text field for membership numbers. Following that I want to look up FirstName & LastName as a sanity check. Before I do that I understand that I need to uniquely name each row under First & Last Name, probably based on the $counter value. Here is my tables current code for ( $counter = 1; $counter <= $PlayerNo; $counter += 1) { echo "<tr><td align='center' valign='center'>"; echo $counter; echo "</td><td align='center' valign='center'>"; echo $points = isset($pointsArray[$counter]) ? $pointsArray[$counter] : 25; ; echo "</td><td align='center' valign='center'>"; echo '<input name="MembershipNo" type="text" size="7" maxlength="7">'; echo "</td><td align='center' valign='center'>"; echo '<input name="FirstName $counter" type="text" size="15" maxlength="7">'; echo "</td><td align='center' valign='center'>"; echo '<input name="LastName[$counter]" type="text" size="15" maxlength="7">'; echo "</td></tr>"; I have tried both of the following but without success: echo "</td><td align='center' valign='center'>"; echo '<input name="FirstName $counter" type="text" size="15" maxlength="7">'; echo "</td><td align='center' valign='center'>"; echo '<input name="LastName[$counter]" type="text" size="15" maxlength="7">'; echo "</td></tr>"; Just to be clear I don't want to change the display at this moment in time, just change the name as viewed in 'view source' eg name="FirstName" (and LastName) changed to name="FirstName1", name="FirstName2" etc for the full value of the $counter. Many Thanks
  25. Awesome thanks a lot, I had looked at the switch method but couldn't work out how best to use it. If I understand your comments correctly I place the function outside the loop and call the function into the cell where I need the result? (and if so how?) Is this correct or should I be placing the function in the cell itself? (agian how?) Thanks so much, sorry for the really noobish questions, but I am a total noob but slowly learning?!
×
×
  • 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.