Jump to content

noj75

Members
  • Posts

    34
  • Joined

  • Last visited

    Never

Everything posted by noj75

  1. Hi guys, I have a form that has some jquery added to it so that my user can add new rows of date by adding more form fields. Here is the script: <?php ob_start(); include('connect.php'); $hID = $_REQUEST['ID']; $hname = $_REQUEST['name']; ?> <head> <script language="Javascript" src="jquery.js" type="text/javascript"></script> <script type="text/javascript" language="javascript"> var current = 1; function addEntry() { current++; var strToAdd = '<tr><td><p><input id="eracedated'+current+'" name="eracedated'+current+'" size="5" /> <input id="eracedatem'+current+'" name="eracedatem'+current+'" size="5" /> <input id="eracetime'+current+'" name="eracetime'+current+'" size="5" /> <input id="eracetype'+current+'" name="eracetype'+current+'" size="15" /> <input id="eraceage'+current+'" name="eraceage'+current+'" size="5" /> <input id="eentdated'+current+'" name="eentdated'+current+'" size="5" /> <input id="eentdatem'+current+'" name="eentdatem'+current+'" size="5" /> <input id="eracetrack'+current+'" name="eracetrack'+current+'" size="15" /> <input id="eracedistance'+current+'" name="eracedistance'+current+'" size="5" /> <input type="hidden" id="ehid'+current+'" name="ehid'+current+'" value="<?php echo $hID; ?>" /><input type="hidden" id="ehorse'+current+'" name="ehorse'+current+'" value="<?php echo $hname; ?>" /></p></td></tr>' $('#mainField').append(strToAdd) } $(document).ready(function(){ $('#addEntry').click(addEntry) }); </script> </head> <style type="text/css"> body { background-color:#4a0303; } </style> <div style="background-color:#734e4e; border:2px solid #000000; color:#FFFFFF; padding:10px; width:770px;"> <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post"> <table width="100%" border="0" cellspacing="0" cellpadding="5"> <tr> <td> <fieldset style="border:none;" id="mainField"> <p> <input id="eracedated1" name="eracedated1" size="5" /> <input id="eracedatem1" name="eracedatem1" size="5" /> <input id="eracetime1" name="eracetime1" size="8" /> <input id="eracetype1" name="eracetype1" size="15" /> <input id="eraceage1" name="eraceage1" size="5" /> <input id="eentdated1" name="eentdated1" size="8" /> <input id="eentdatem1" name="eentdatem1" size="8" /> <input id="eracetrack1" name="eracetrack1" size="15" /> <input id="eracedistance1" name="eracedistance1" size="5" /> <input type="hidden" id="ehid1" name="ehid1" value="<?php echo $hID; ?>" /> <input type="hidden" id="ehorse1" name="ehorse1" value="<?php echo $hname; ?>" /> </p> </fieldset> </td> </tr> <tr> <td> <p> <input type="button" id="addEntry" value="Add Another Entry"> </p> </td> </tr> <tr> <td> <input type="submit" value="Upload Entries"> <input type="submit" name="cancel" onclick="window.parent.location.href=window.parent.location.href;" value="Cancel" /> </td> </tr> </table> </form> </div> If my user clicks the addentry button a new set of fields will appear so that they can add another row. Now comes the tricky part, how the hell do I process this with PHP to add each line as a record into my database? It really is stumping me on how to do it. Any help, as always, is very much appreciated. Kind regards
  2. Will have a good dig into that right now. Thanks again, thats just put to end 3 hours of pulling my hair out. Kindest regards NOJ75
  3. Sorry wildteen, didnt quite understand you the first time Added global $rcr_clients to the function and it is now working a treat Thank you very much for your time and help in solving this problem for me. Extremely appreciated.
  4. The variable $rcr_clients is defined in the included database connection file. Do I need to connect to the database within the function then?
  5. Sorry mate, I wasnt ignoring you. I have added print before as you have suggested but to no avail. It still does not return anything. Can you help further? I appreciate your time
  6. Hi fella's, Thanks for the snappy replies. OK here is the info: functions.php <?php include('db_con.php'); function selectClients() { $qperm_qry = "SELECT * FROM $rcr_clients "; $qperm_res = mysql_query($qperm_qry); while($qsamerow = mysql_fetch_array($qperm_res)) { $clients .= '<option value="index.php?horse_id='.$qsamerow['c_id'].'">'.$qsamerow['c_name'].'</option>'; } return $clients; } ?> index.php <option value="">Select Client</option> <?php selectClients(); ?> Obviously I have the include functions.php etc etc the above is just the section I want to get working. Any advances on this?
  7. Hi Guys, I am getting there slowly with my PHP experience but have always had trouble understanding functions. I am trying to include a functions.php page with the following function in it: function selectClients() { $qperm_qry = "SELECT * FROM $clients "; $qperm_res = mysql_query($qperm_qry); while($qsamerow = mysql_fetch_array($qperm_res)) { $clients = '<option value="includes/index.php?id='.$qsamerow['id'].'">'.$qsamerow['name'].'</option>'; $qsamerow++; } return $clients; } I want this to return a list of option elements containing a clints id and name. In the main page I call the fuction like so: selectClients(); It doesnt show what I want it to. Can anyone please help me? Many thanks!
  8. Hi, OK, $proname (s_name) is the username. So, if I ($proname) have entered a load of surnames into s_sur and I want to see who else (i.e which other usernames) have entered the same surnames as me I would have to query the database and show me the results. I only want to list other members surnames and exclude my own. Does that clear it up? ???
  9. Hi to all on this great site! I am desperate for some help: $samesurn = "SELECT * FROM $stb WHERE s_sur IN (SELECT s_sur FROM $stb WHERE s_name='$proname') AND s_name!='$proname' "; I am trying to do the above query: $proname has a list of values in s_sur. I want to query the database to see who else has the same values and then display the results excluding $proname's own results. This does work but is TERRIBLY slow. Is there another way to do this? Any help is greatly appreciated. Thank you.
×
×
  • 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.