Jump to content

downah

Members
  • Posts

    127
  • Joined

  • Last visited

Everything posted by downah

  1. Thanks, just realized it myself first time using ENUM fields thought it was default 0 and 1 or something
  2. Hey guys, I am trying to create this table, but phpmyadmin is giving me this error and I don't understand why.. could anyone show the light? Error SQL query: CREATE TABLE `socialscenes`.`Members` ( `memberID` INT( 4 ) NOT NULL , `username` VARCHAR( 20 ) NOT NULL , `password` VARCHAR( 20 ) NOT NULL , `email` VARCHAR( 50 ) NOT NULL , `datejoined` DATE NOT NULL , `lastvisit` DATE NOT NULL , `firstname` VARCHAR( 20 ) NOT NULL , `familyname` VARCHAR( 20 ) NOT NULL , `memberage` INT( 2 ) NOT NULL , `town` VARCHAR( 20 ) NOT NULL , `postcode` VARCHAR( 6 ) NOT NULL , `dob` DATE NOT NULL , `photo` VARCHAR( 50 ) NOT NULL , `agreewithterms` ENUM NOT NULL , `proactiveemails` INT( 2 ) NOT NULL , `eventshosted` INT( 3 ) NOT NULL , `eventsattended` INT( 3 ) NOT NULL , `warnings` INT( 2 ) NOT NULL , `banned` ENUM NOT NULL , `karmarating` INT( 4 ) NOT NULL , `selfdescription` TEXT NOT NULL , `gender` VARCHAR( 10 ) NOT NULL , PRIMARY KEY ( `memberID` ) , INDEX ( `familyname` ) , UNIQUE ( `username` ) ) ENGINE = InnoDB MySQL said: Documentation #1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'NOT NULL, `proactiveemails` INT(2) NOT NULL, `eventshosted` INT(3) NOT NULL, `ev' at line 1
  3. I solved it with an else if, I am simply just not going to run that query unless I need to, all working nicely without errors now, but thanks for your suggestion, it will help me for the future for sending out queries
  4. Ah that makes sense, because it does not show the records afterwards as its lost the previous form, so it fails on that.. how could I retrieve this info or go around this? I might have an idea.. but any input on while I work on it is very welcome
  5. Hi guys, I have this code here working which will show certain data in the table depending on what string the user searches for, and with the records that pop up you are able to delete these records too.. now all this is working but after I delete records I get this error: "Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/define/public_html/golf/Pete/php/searchcallback.php on line 22" I assume this is because num rows are empty after the deletion is done/ and this now shows "no records showing" can anyone help me why this error is popping up? Although deletion does work, I would like to get rid of this error message. <?php include "connect.php"; $searchvalue = $_POST['searchvalue']; $su = $_POST['search']; //Check if records were submitted for deletion if(isset($_POST['callbackid']) && count($_POST['callbackid'])) { //Ensure values are ints $deleteIDs = implode(', ', array_map('intval', $_POST['callbackid'])); $query = "DELETE FROM callback WHERE callbackid IN ({$deleteIDs})"; //Debug line echo "<br/>Successfuly deleted callback(s) <br/>"; mysql_query($query) or die(mysql_error()); } $result = mysql_query("SELECT * FROM callback WHERE $searchvalue LIKE '%$su%'"); $num_rows = mysql_num_rows($result); ?> <link rel="stylesheet" type="text/css" href="view.css" media="all"> <script type="text/javascript" src="view.js"></script> <body id="main_body" > <img id="top" src="top.png" alt=""> <div id="form_container"> <h1>Show, Search or Delete Callback Records<</h1> <form id="form_362567" class="appnitro" method="post" action="searchcallback.php"> <div class="form_description"> <h2> Show, Search or Delete Callback Records</h2> <p></p> </div> <ul > <li class="section_break"> <?php if ($num_rows==0){ ?> <br>No records found<br><br> <INPUT TYPE="button" VALUE="Go Back" onClick="history.go(-1);return true;"><br> <?php } else{ while($row = mysql_fetch_array($result)) { //..results as in your post. echo "<form action='' method='POST'>"; echo "<br/>"; echo "<b>Callback ID:</b>"; echo "<br/>"; echo $row['callbackid']; echo "<br/>"; echo "<b>Full Name:</b>"; echo "<br/>"; echo $row['fullname']; echo "<br/>"; echo "<b>E-mail:</b>"; echo "<br/>"; echo $row['email']; echo "<br/>"; echo "<b>Phone Number:</b>"; echo "<br/>"; echo $row['phone']; echo "<br/>"; echo "<b>Comment:</b>"; echo "<br/>"; echo $row['comment']; echo "<br/>"; echo "<input type='checkbox' name='callbackid[]' value='{$row['callbackid']}' /> <b>Delete</b>\n"; ?> <li class="section_break"> <?php } ?> <br><input type='submit' value='Delete Records' name='delete' /><INPUT TYPE="button" VALUE="Cancel" onClick="history.go(-1);return true;"><br> </form> <div id="footer"> </div> </div> <img id="bottom" src="bottom.png" alt=""> </body> <?php } ?> Thanks for any help in advance
  6. Thanks, I have searched on google there is a few things out there with pear for example but what I like about discussion forums and asking questions here is the answers are personalized to my problem, instead of someone else's, I don't mean to do harm
  7. I have got this running, which takes 2 fields subject and plain and will email it to the emails in the database, how can I make it so I have another field which he can upload for example .pdf files and send them with the email? <?php include "connect.php"; $subject = stripslashes($_POST["subject"]); $plain = stripslashes($_POST["plain"]); $result = mysql_query("SELECT email FROM member"); $emails = array(); while ($row = mysql_fetch_row($result)) $emails[] = $row[0]; $subject = $_POST['subject']; $from = "noreply@wgtfgb.com"; $headers = "From:" . $from; $to = implode(", ", $emails); mail($to, $_POST['subject'], $_POST["plain"], $headers); ?> <link rel="stylesheet" type="text/css" href="view.css" media="all"> <script type="text/javascript" src="view.js"></script> <form id='register' action='updateprofile.php' method='post' accept-charset='UTF-8'> <body id="main_body" > <img id="top" src="top.png" alt=""> <div id="form_container"> <h1>Newsletter Sent</h1> <form id="form_362567" class="appnitro" method="post" action=""> <div class="form_description"> <h2> Newsletter Sent</h2> <p></p> </div> <ul > <li class="section_break"> <p></p> </li> <li id="li_2" > <label class="description" for="email"> <?php echo "Newsletter successfully sent, you will be redirected back to the member area in 5 seconds."; ?> </form> <div id="footer"> <meta http-equiv="refresh" content="5; URL=index.php"> </div> </div> <img id="bottom" src="bottom.png" alt=""> </body>
  8. Hi, I am using the phpmailer class and a little script I found online, I have a form with a textarea called "plain" which submits and takes the action through to this page: <?php #include PHPMailer class and database connection include("class.phpmailer.php"); include("connect.php"); #remove slashes from content $plain = stripslashes($_POST["plain"]); #initiate PHPMailer class $mail = new PHPMailer(); #set the from e-mail address $mail->From = "email@email.com"; #set the from name $mail->FromName = "myname"; #the subject of the email $mail->Subject = "Our Newsletter"; #the HTML content of the email $mail->Body = $plain; #loop through e-mail addresses $query = "SELECT email FROM member"; $result = mysql_db_query ("define_pete", $query); while ($myrow = mysql_fetch_array($result)){ #add subscribers address as the recipient $mail->AddAddress($myrow["fldEmail"]); #sends the newsletter $mail->Send(); #clears the recipient address $mail->ClearAddresses(); } ?> It gives no errors and goes through, yet it definitely sends no emails out, I have made sure the emails are correct in the field email in the table member but it is, anyone got any clue what is going wrong? Appreciated
  9. Deleted all the forms except one and put it all into one validation page while having 2 submit buttons if(isset($_POST['updateprofile'])) { //code to update profile } else if (isset($_POST['updatepassword'])) { //code to update password } Thanks s3cr3t I finally understood hehe
  10. In your code there is one form which ends after the password, but that is the wrong form, the whole profile (all input except passwords also email though) should go to the updateprofile.php which you have, and just the passwords should go to updatepassword.php, or should I just stop this completely and have updatepassword running in updateprofile so it is in one validation file?
  11. Thanks for your input, still looking for a way to get this working though.
  12. Thanks a lot, that makes sense then, any other way around this while keeping the input text areas on the same position?
  13. <form onsubmit='return formValidator()' id='register' action='updateprofile.php' method='post' accept-charset='UTF-8'> is inside the first form--> <form onsubmit='' id='update' action='updatepassword.php' method='post' accept-charset='UTF-8'> I don't really understand what you mean I am sorry.. I thought both forms with different submit buttons would update to a different validate form, could you explain further what you mean with that?
  14. I see thanks! So what would be the valid code, I can just put after the if - action="validation.php"; ? This is the code I am running atm to add a user, I really only care about the email and maybe if some fields atleast have a value. <?php include "connect.php"; echo '<p><a href="index.php">Home</a></p>'; if(isset($_SESSION['email'])) { ?> <link rel="stylesheet" type="text/css" href="view.css" media="all"> <script type="text/javascript" src="view.js"></script> <form onsubmit='return formValidator()' id='register' action='addeduser.php' method='post' accept-charset='UTF-8'> <body id="main_body" > <img id="top" src="top.png" alt=""> <div id="form_container"> <h1>Add a Member</h1> <form id="form_362567" class="appnitro" method="post" action=""> <div class="form_description"> <h2> Add a Member</h2> <p></p> </div> <ul > <li class="section_break"> <h3>Login Details</h3> <p></p> </li> <li id="li_2" > <label class="description" for="email">Email: </label> <div> <input id="email" name="email" class="element text medium" type="text" maxlength="255" value=""/> </div> </li> <li id="li_3" > <label class="description" for="password">Password (Must be between 6-50 characters) </label> <div> <input id="password" name="password" class="element text medium" type="password" maxlength="255" value=""/> </div> </li> <li id="li_4" > <label class="description" for="confirmpw">Confirm Password: </label> <div> <input id="confirmpw" name="confirmpw" class="element text medium" type="text" maxlength="255" value=""/> </div> </li> <li class="section_break"> <h3>Personal Details</h3> <p></p> </li> <li id="li_6" > <label class="description" for="element_6">Name: </label> <span> <input id="firstname" name= "firstname" class="element text" maxlength="255" size="8" value=""/> <label>First</label> </span> <span> <input id="lastname" name= "lastname" class="element text" maxlength="255" size="14" value=""/> <label>Last</label> </span> </li> <li id="li_7" > <label class="description" for="website">Web Site: </label> <div> <input id="website" name="website" class="element text medium" type="text" maxlength="255" value=""/> </div> </li> <li id="li_12" > </li> <li id="li_11" > <label class="description" for="element_11">Contact Details </label> <div> <input id="address1" name="address1" class="element text large" value="" type="text"> <label for="element_11_1">Street Address</label> </div> <div> <input id="address2" name="address2" class="element text large" value="" type="text"> <label for="element_11_2">Address Line 2</label> </div> <div class="left"> <input id="city" name="city" class="element text medium" value="" type="text"> <label for="element_11_3">City</label> </div> <div class="right"> <input id="phone" name="phone" class="element text medium" value="" type="text"> <label for="element_11_4">Phone Number</label> </div> <div class="left"> <input id="postcode" name="postcode" class="element text medium" maxlength="15" value="" type="text"> <label for="element_11_5">Postcode</label> </div> <div class="right"> <select class="element select medium" id="county" name="county"> <option value="" selected="selected"></option> <optgroup label="England"> <option>Bedfordshire</option> <option>Berkshire</option> <option>Bristol</option> <option>Buckinghamshire</option> <option>Cambridgeshire</option> <option>Cheshire</option> <option>City of London</option> <option>Cornwall</option> <option>Cumbria</option> <option>Derbyshire</option> <option>Devon</option> <option>Dorset</option> <option>Durham</option> <option>East Riding of Yorkshire</option> <option>East Sussex</option> <option>Essex</option> <option>Gloucestershire</option> <option>Greater London</option> <option>Greater Manchester</option> <option>Hampshire</option> <option>Herefordshire</option> <option>Hertfordshire</option> <option>Isle of Wight</option> <option>Kent</option> <option>Lancashire</option> <option>Leicestershire</option> <option>Lincolnshire</option> <option>Merseyside</option> <option>Norfolk</option> <option>North Yorkshire</option> <option>Northamptonshire</option> <option>Northumberland</option> <option>Nottinghamshire</option> <option>Oxfordshire</option> <option>Rutland</option> <option>Shropshire</option> <option>Somerset</option> <option>South Yorkshire</option> <option>Staffordshire</option> <option>Suffolk</option> <option>Surrey</option> <option>Tyne and Wear</option> <option>Warwickshire</option> <option>West Midlands</option> <option>West Sussex</option> <option>West Yorkshire</option> <option>Wiltshire</option> <option>Worcestershire</option> </optgroup> <optgroup label="Wales"> <option>Anglesey</option> <option>Brecknockshire</option> <option>Caernarfonshire</option> <option>Carmarthenshire</option> <option>Cardiganshire</option> <option>Denbighshire</option> <option>Flintshire</option> <option>Glamorgan</option> <option>Merioneth</option> <option>Monmouthshire</option> <option>Montgomeryshire</option> <option>Pembrokeshire</option> <option>Radnorshire</option> </optgroup> <optgroup label="Scotland"> <option>Aberdeenshire</option> <option>Angus</option> <option>Argyllshire</option> <option>Ayrshire</option> <option>Banffshire</option> <option>Berwickshire</option> <option>Buteshire</option> <option>Cromartyshire</option> <option>Caithness</option> <option>Clackmannanshire</option> <option>Dumfriesshire</option> <option>Dunbartonshire</option> <option>East Lothian</option> <option>Fife</option> <option>Inverness-shire</option> <option>Kincardineshire</option> <option>Kinross</option> <option>Kirkcudbrightshire</option> <option>Lanarkshire</option> <option>Midlothian</option> <option>Morayshire</option> <option>Nairnshire</option> <option>Orkney</option> <option>Peeblesshire</option> <option>Perthshire</option> <option>Renfrewshire</option> <option>Ross-shire</option> <option>Roxburghshire</option> <option>Selkirkshire</option> <option>Shetland</option> <option>Stirlingshire</option> <option>Sutherland</option> <option>West Lothian</option> <option>Wigtownshire</option> </optgroup> <optgroup label="Northern Ireland"> <option>Antrim</option> <option>Armagh</option> <option>Down</option> <option>Fermanagh</option> <option>Londonderry</option> <option>Tyrone</option> </optgroup> </select> <label for="element_11_6">County</label> </div> <br> <label for='dob' class="element text medium" >Date of Birth:</label><br> <select name="dobmonth" id="dobmonth"> <option> - Month - </option> <option value="January">January</option> <option value="Febuary">Febuary</option> <option value="March">March</option> <option value="April">April</option> <option value="May">May</option> <option value="June">June</option> <option value="July">July</option> <option value="August">August</option> <option value="September">September</option> <option value="October">October</option> <option value="November">November</option> <option value="December">December</option> </select> <select name="dobday" id="dobday"> <option> - Day - </option> <option value="1">1</option> <option value="2">2</option> <option value="3">3</option> <option value="4">4</option> <option value="5">5</option> <option value="6">6</option> <option value="7">7</option> <option value="8">8</option> <option value="9">9</option> <option value="10">10</option> <option value="11">11</option> <option value="12">12</option> <option value="13">13</option> <option value="14">14</option> <option value="15">15</option> <option value="16">16</option> <option value="17">17</option> <option value="18">18</option> <option value="19">19</option> <option value="20">20</option> <option value="21">21</option> <option value="22">22</option> <option value="23">23</option> <option value="24">24</option> <option value="25">25</option> <option value="26">26</option> <option value="27">27</option> <option value="28">28</option> <option value="29">29</option> <option value="30">30</option> <option value="31">31</option> </select> <select name="dobyear" id="dobyear"> <option> - Year - </option> <option value="2004">2004</option> <option value="2003">2003</option> <option value="2002">2002</option> <option value="2001">2001</option> <option value="2000">2000</option> <option value="1999">1999</option> <option value="1998">1998</option> <option value="1997">1997</option> <option value="1996">1996</option> <option value="1995">1995</option> <option value="1994">1994</option> <option value="1993">1993</option> <option value="1992">1992</option> <option value="1991">1991</option> <option value="1990">1990</option> <option value="1989">1989</option> <option value="1988">1988</option> <option value="1987">1987</option> <option value="1986">1986</option> <option value="1985">1985</option> <option value="1984">1984</option> <option value="1983">1983</option> <option value="1982">1982</option> <option value="1981">1981</option> <option value="1980">1980</option> <option value="1979">1979</option> <option value="1978">1978</option> <option value="1977">1977</option> <option value="1976">1976</option> <option value="1975">1975</option> <option value="1974">1974</option> <option value="1973">1973</option> <option value="1972">1972</option> <option value="1971">1971</option> <option value="1970">1970</option> <option value="1969">1969</option> <option value="1968">1968</option> <option value="1967">1967</option> <option value="1966">1966</option> <option value="1965">1965</option> <option value="1964">1964</option> <option value="1963">1963</option> <option value="1962">1962</option> <option value="1961">1961</option> <option value="1960">1960</option> <option value="1959">1959</option> <option value="1958">1958</option> <option value="1957">1957</option> <option value="1956">1956</option> <option value="1955">1955</option> <option value="1954">1954</option> <option value="1953">1953</option> <option value="1952">1952</option> <option value="1951">1951</option> <option value="1950">1950</option> <option value="1949">1949</option> <option value="1948">1948</option> <option value="1947">1947</option> <option value="1946">1946</option> <option value="1945">1945</option> <option value="1944">1944</option> <option value="1943">1943</option> <option value="1942">1942</option> <option value="1941">1941</option> <option value="1940">1940</option> <option value="1939">1939</option> <option value="1938">1938</option> <option value="1937">1937</option> <option value="1936">1936</option> <option value="1935">1935</option> <option value="1934">1934</option> <option value="1933">1933</option> <option value="1932">1932</option> <option value="1931">1931</option> <option value="1930">1930</option> <option value="1929">1929</option> <option value="1928">1928</option> <option value="1927">1927</option> <option value="1926">1926</option> <option value="1925">1925</option> <option value="1924">1924</option> <option value="1923">1923</option> <option value="1922">1922</option> <option value="1921">1921</option> <option value="1920">1920</option> <option value="1919">1919</option> <option value="1918">1918</option> <option value="1917">1917</option> <option value="1916">1916</option> <option value="1915">1915</option> <option value="1914">1914</option> <option value="1913">1913</option> <option value="1912">1912</option> <option value="1911">1911</option> <option value="1910">1910</option> <option value="1909">1909</option> <option value="1908">1908</option> <option value="1907">1907</option> <option value="1906">1906</option> <option value="1905">1905</option> <option value="1904">1904</option> <option value="1903">1903</option> <option value="1902">1902</option> <option value="1901">1901</option> <option value="1900">1900</option> </select><br><br> </li> <li id="li_29" > <label class="description" for="element_29">Sex: </label> <div> <select class="element select medium" id="Sex" name="Sex"> <option value="" selected="selected"></option> <option value="Male" >Male</option> <option value="Female" >Female</option> </select> </div> </li> <li class="section_break"> <h3>Experience</h3> <p></p> </li> <li id="li_15" > <label class="description" for="element_15">Level: </label> <div> <input id="Level" name="Level" class="element text small" type="text" maxlength="255" value=""/> </div> </li> <li id="li_14" > <label class="description" for="element_14">Services Offered: </label> <div> <textarea id="services" name="services" class="element textarea medium"></textarea> </div> </li> <li id="li_16" > <label class="description" for="element_16">Philosophy: </label> <div> <textarea id="philosophy" name="philosophy" class="element textarea medium"></textarea> </div> </li> <li id="li_17" > <label class="description" for="element_17">Mission Statement: </label> <div> <textarea id="mission" name="mission" class="element textarea medium"></textarea> </div> </li> <li id="li_18" > <label class="description" for="element_18">Customer promises above WGTF promises: </label> <div> <textarea id="customerpromises" name="customerpromises" class="element textarea medium"></textarea> </div> </li> <li id="li_19" > <label class="description" for="element_19">Courses undertaken through WGTF: </label> <div> <textarea id="coursesundertaken" name="coursesundertaken" class="element textarea medium"></textarea> </div> </li> <li id="li_20" > <label class="description" for="element_20">Other Courses: </label> <div> <textarea id="othercourses" name="othercourses" class="element textarea medium"></textarea> </div> </li> <li id="li_21" > <label class="description" for="element_21">Other non-golf Certifications: </label> <div> <textarea id="nongolfcert" name="nongolfcert" class="element textarea medium"></textarea> </div> </li> <li id="li_30" > <label class="description" for="element_30">CRB Checked: </label> <div> <select class="element select small" id="crbcheck" name="crbcheck"> <option value="" selected="selected"></option> <option value="Yes" >Yes</option> <option value="No" >No</option> </select> </div> </li> <li id="li_31" > <label class="description" for="element_31">First Aid Certified: </label> <div> <select class="element select small" id="firstaid" name="firstaid"> <option value="" selected="selected"></option> <option value="Yes" >Yes</option> <option value="No" >No</option> </select> </div> </li> <li id="li_22" > <label class="description" for="element_22">Latest CPD: </label> <div> <textarea id="latestcpd" name="latestcpd" class="element textarea medium"></textarea> </div> </li> <li id="li_23" > <label class="description" for="element_23">CPD Goals: </label> <div> <textarea id="cpdgoals" name="cpdgoals" class="element textarea medium"></textarea> </div> </li> <li id="li_24" > <label class="description" for="element_24">Most Influential Coach or Player: </label> <div> <input id="mostinfluential" name="mostinfluential" class="element text medium" type="text" maxlength="255" value=""/> </div> </li> <li id="li_25" > <label class="description" for="element_25">Main Strengths: </label> <div> <textarea id="mainstrength" name="mainstrength" class="element textarea medium"></textarea> </div> </li> <li id="li_26" > <label class="description" for="element_26">Years' Golfing Experience: </label> <div> <input id="yeargolfexperience" name="yeargolfexperience" class="element text small" type="text" maxlength="255" value=""/> </div> </li> <li id="li_27" > <label class="description" for="element_27">Customer Feedback Rating: </label> <div> <input id="customerfeedback" name="customerfeedback" class="element text small" type="text" maxlength="255" value=""/> </div> </li> <li id="li_28" > <label class="description" for="element_28">WGTF Rating: </label> <div> <input id="wgtffeedback" name="wgtffeedback" class="element text small" type="text" maxlength="255" value=""/> </div> </li> <input type='submit' name='Submit' value='Submit' /> </form> <div id="footer"> </div> </div> <img id="bottom" src="bottom.png" alt=""> </body> <?php } else { echo 'You can not do this if you are not logged in.'; } ?>
  15. Hi guys, as shown in the code I have a form running in another form, the first form submits to updateprofile.php but within that I have got another submit button and another form which should submit to updatepassword.php, but when I click the button which should take the action to updatepassword.php it still takes me through to updateprofile.php, so for some reason the 2nd form is not recognizable? any help here? <?php include "connect.php"; echo '<p><a href="index.php">Home</a></p>'; if(isset($_SESSION['email'])) $email = $_SESSION['email']; { $result = mysql_query("SELECT id, email, firstname, lastname, website, address1, address2, city, postcode, phone, county, dobmonth, dobday, dobyear, Sex, Level, services, philosophy, mission, customerpromises, coursesundertaken, othercourses, nongolfcert, crbcheck, firstaid, latestcpd, cpdgoals, mostinfluential, mainstrength, yeargolfexperience, customerfeedback, wgtffeedback FROM member WHERE email = '$email'") or die(mysql_error()); while($row = mysql_fetch_array($result)) { ?> <link rel="stylesheet" type="text/css" href="view.css" media="all"> <script type="text/javascript" src="view.js"></script> <form onsubmit='return formValidator()' id='register' action='updateprofile.php' method='post' accept-charset='UTF-8'> <body id="main_body" > <img id="top" src="top.png" alt=""> <div id="form_container"> <h1>Add a Member</h1> <form id="form_362567" class="appnitro" method="post" action=""> <div class="form_description"> <h2> My Profile</h2> <p></p> </div> <ul > <li class="section_break"> <h3>Login Details</h3> <p></p> </li> <li id="li_2" > <label class="description" for="email">Email: </label> <div> <input id="email" name="email" class="element text medium" type="text" maxlength="255" value="<?php echo $row['email']; ?>"/> </div> </li> <form onsubmit='' id='update' action='updatepassword.php' method='post' accept-charset='UTF-8'> <li id="li_3" > <label class="description" for="password">Old Password </label> <div> <input id="oldpassword" name="oldpassword" class="element text medium" type="password" maxlength="255" value=""/> </div> </li> <li id="li_4" > <label class="description" for="confirmpw">New Password: (Must be between 6-50 characters) </label> <div> <input id="newpassword" name="newpassword" class="element text medium" type="text" maxlength="255" value=""/> </div> </li> <li id="li_4" > <label class="description" for="confirmpw">Confirm New Password: </label> <div> <input id="confirmnewpassword" name="confirmnewpassword" class="element text medium" type="text" maxlength="255" value=""/> <br><input type='submit' name='Submit' value='Update Password' /> </div> </form> </li><li class="section_break"> <h3>Personal Details</h3> <p></p> </li> <li id="li_6" > <label class="description" for="element_6">Name: </label> <span> <input id="firstname" name= "firstname" class="element text" maxlength="255" size="8" value="<?php echo $row['firstname']; ?>"/> <label>First</label> </span> <span> <input id="lastname" name= "lastname" class="element text" maxlength="255" size="14" value="<?php echo $row['lastname']; ?>"/> <label>Last</label> </span> </li> <li id="li_7" > <label class="description" for="website">Web Site: </label> <div> <input id="website" name="website" class="element text medium" type="text" maxlength="255" value="<?php echo $row['website']; ?>"/> </div> </li> <li id="li_12" > </li> <li id="li_11" > <label class="description" for="element_11">Contact Details </label> <div> <input id="address1" name="address1" class="element text large" value="<?php echo $row['address1']; ?>" type="text"> <label for="element_11_1">Street Address</label> </div> <div> <input id="address2" name="address2" class="element text large" value="<?php echo $row['address2']; ?>" type="text"> <label for="element_11_2">Address Line 2</label> </div> <div class="left"> <input id="city" name="city" class="element text medium" value="<?php echo $row['city']; ?>" type="text"> <label for="element_11_3">City</label> </div> <div class="right"> <input id="phone" name="phone" class="element text medium" value="<?php echo $row['phone']; ?>" type="text"> <label for="element_11_4">Phone Number</label> </div> <div class="left"> <input id="postcode" name="postcode" class="element text medium" maxlength="15" value="<?php echo $row['postcode']; ?>" type="text"> <label for="element_11_5">Postcode</label> </div> <div class="right"> <select class="element select medium" id="county" name="county"> <option value="<?php echo $row['county']; ?>" selected="selected"><?php echo $row['county']; ?></option> <optgroup label="England"> <option>Bedfordshire</option> <option>Berkshire</option> <option>Bristol</option> <option>Buckinghamshire</option> <option>Cambridgeshire</option> <option>Cheshire</option> <option>City of London</option> <option>Cornwall</option> <option>Cumbria</option> <option>Derbyshire</option> <option>Devon</option> <option>Dorset</option> <option>Durham</option> <option>East Riding of Yorkshire</option> <option>East Sussex</option> <option>Essex</option> <option>Gloucestershire</option> <option>Greater London</option> <option>Greater Manchester</option> <option>Hampshire</option> <option>Herefordshire</option> <option>Hertfordshire</option> <option>Isle of Wight</option> <option>Kent</option> <option>Lancashire</option> <option>Leicestershire</option> <option>Lincolnshire</option> <option>Merseyside</option> <option>Norfolk</option> <option>North Yorkshire</option> <option>Northamptonshire</option> <option>Northumberland</option> <option>Nottinghamshire</option> <option>Oxfordshire</option> <option>Rutland</option> <option>Shropshire</option> <option>Somerset</option> <option>South Yorkshire</option> <option>Staffordshire</option> <option>Suffolk</option> <option>Surrey</option> <option>Tyne and Wear</option> <option>Warwickshire</option> <option>West Midlands</option> <option>West Sussex</option> <option>West Yorkshire</option> <option>Wiltshire</option> <option>Worcestershire</option> </optgroup> <optgroup label="Wales"> <option>Anglesey</option> <option>Brecknockshire</option> <option>Caernarfonshire</option> <option>Carmarthenshire</option> <option>Cardiganshire</option> <option>Denbighshire</option> <option>Flintshire</option> <option>Glamorgan</option> <option>Merioneth</option> <option>Monmouthshire</option> <option>Montgomeryshire</option> <option>Pembrokeshire</option> <option>Radnorshire</option> </optgroup> <optgroup label="Scotland"> <option>Aberdeenshire</option> <option>Angus</option> <option>Argyllshire</option> <option>Ayrshire</option> <option>Banffshire</option> <option>Berwickshire</option> <option>Buteshire</option> <option>Cromartyshire</option> <option>Caithness</option> <option>Clackmannanshire</option> <option>Dumfriesshire</option> <option>Dunbartonshire</option> <option>East Lothian</option> <option>Fife</option> <option>Inverness-shire</option> <option>Kincardineshire</option> <option>Kinross</option> <option>Kirkcudbrightshire</option> <option>Lanarkshire</option> <option>Midlothian</option> <option>Morayshire</option> <option>Nairnshire</option> <option>Orkney</option> <option>Peeblesshire</option> <option>Perthshire</option> <option>Renfrewshire</option> <option>Ross-shire</option> <option>Roxburghshire</option> <option>Selkirkshire</option> <option>Shetland</option> <option>Stirlingshire</option> <option>Sutherland</option> <option>West Lothian</option> <option>Wigtownshire</option> </optgroup> <optgroup label="Northern Ireland"> <option>Antrim</option> <option>Armagh</option> <option>Down</option> <option>Fermanagh</option> <option>Londonderry</option> <option>Tyrone</option> </optgroup> </select> <label for="element_11_6">County</label> </div> <br> <label for='dob' class="element text medium" >Date of Birth:</label><br> <select name="dobmonth" id="dobmonth"> <option value="<?php echo $row['dobmonth']; ?>" selected="selected"><?php echo $row['dobmonth']; ?></option> <option value="January">January</option> <option value="Febuary">Febuary</option> <option value="March">March</option> <option value="April">April</option> <option value="May">May</option> <option value="June">June</option> <option value="July">July</option> <option value="August">August</option> <option value="September">September</option> <option value="October">October</option> <option value="November">November</option> <option value="December">December</option> </select> <select name="dobday" id="dobday"> <option value="<?php echo $row['dobday']; ?>" selected="selected"><?php echo $row['dobday']; ?></option> <option value="1">1</option> <option value="2">2</option> <option value="3">3</option> <option value="4">4</option> <option value="5">5</option> <option value="6">6</option> <option value="7">7</option> <option value="8">8</option> <option value="9">9</option> <option value="10">10</option> <option value="11">11</option> <option value="12">12</option> <option value="13">13</option> <option value="14">14</option> <option value="15">15</option> <option value="16">16</option> <option value="17">17</option> <option value="18">18</option> <option value="19">19</option> <option value="20">20</option> <option value="21">21</option> <option value="22">22</option> <option value="23">23</option> <option value="24">24</option> <option value="25">25</option> <option value="26">26</option> <option value="27">27</option> <option value="28">28</option> <option value="29">29</option> <option value="30">30</option> <option value="31">31</option> </select> <select name="dobyear" id="dobyear"> <option value="<?php echo $row['dobyear']; ?>" selected="selected"><?php echo $row['dobyear']; ?></option> <option value="2004">2004</option> <option value="2003">2003</option> <option value="2002">2002</option> <option value="2001">2001</option> <option value="2000">2000</option> <option value="1999">1999</option> <option value="1998">1998</option> <option value="1997">1997</option> <option value="1996">1996</option> <option value="1995">1995</option> <option value="1994">1994</option> <option value="1993">1993</option> <option value="1992">1992</option> <option value="1991">1991</option> <option value="1990">1990</option> <option value="1989">1989</option> <option value="1988">1988</option> <option value="1987">1987</option> <option value="1986">1986</option> <option value="1985">1985</option> <option value="1984">1984</option> <option value="1983">1983</option> <option value="1982">1982</option> <option value="1981">1981</option> <option value="1980">1980</option> <option value="1979">1979</option> <option value="1978">1978</option> <option value="1977">1977</option> <option value="1976">1976</option> <option value="1975">1975</option> <option value="1974">1974</option> <option value="1973">1973</option> <option value="1972">1972</option> <option value="1971">1971</option> <option value="1970">1970</option> <option value="1969">1969</option> <option value="1968">1968</option> <option value="1967">1967</option> <option value="1966">1966</option> <option value="1965">1965</option> <option value="1964">1964</option> <option value="1963">1963</option> <option value="1962">1962</option> <option value="1961">1961</option> <option value="1960">1960</option> <option value="1959">1959</option> <option value="1958">1958</option> <option value="1957">1957</option> <option value="1956">1956</option> <option value="1955">1955</option> <option value="1954">1954</option> <option value="1953">1953</option> <option value="1952">1952</option> <option value="1951">1951</option> <option value="1950">1950</option> <option value="1949">1949</option> <option value="1948">1948</option> <option value="1947">1947</option> <option value="1946">1946</option> <option value="1945">1945</option> <option value="1944">1944</option> <option value="1943">1943</option> <option value="1942">1942</option> <option value="1941">1941</option> <option value="1940">1940</option> <option value="1939">1939</option> <option value="1938">1938</option> <option value="1937">1937</option> <option value="1936">1936</option> <option value="1935">1935</option> <option value="1934">1934</option> <option value="1933">1933</option> <option value="1932">1932</option> <option value="1931">1931</option> <option value="1930">1930</option> <option value="1929">1929</option> <option value="1928">1928</option> <option value="1927">1927</option> <option value="1926">1926</option> <option value="1925">1925</option> <option value="1924">1924</option> <option value="1923">1923</option> <option value="1922">1922</option> <option value="1921">1921</option> <option value="1920">1920</option> <option value="1919">1919</option> <option value="1918">1918</option> <option value="1917">1917</option> <option value="1916">1916</option> <option value="1915">1915</option> <option value="1914">1914</option> <option value="1913">1913</option> <option value="1912">1912</option> <option value="1911">1911</option> <option value="1910">1910</option> <option value="1909">1909</option> <option value="1908">1908</option> <option value="1907">1907</option> <option value="1906">1906</option> <option value="1905">1905</option> <option value="1904">1904</option> <option value="1903">1903</option> <option value="1902">1902</option> <option value="1901">1901</option> <option value="1900">1900</option> </select><br><br> </li> <li id="li_29" > <label class="description" for="element_29">Sex: </label> <div> <select class="element select medium" id="Sex" name="Sex"> <option value="<?php echo $row['Sex']; ?>" selected="selected"><?php echo $row['Sex']; ?></option> <option value="Male" >Male</option> <option value="Female" >Female</option> </select> </div> </li> <li class="section_break"> <h3>Experience</h3> <p></p> </li> <li id="li_15" > <label class="description" for="element_15">Level: </label> <div> <input id="Level" name="Level" class="element text small" type="text" maxlength="255" value="<?php echo $row['Level']; ?>"/> </div> </li> <li id="li_14" > <label class="description" for="element_14">Services Offered: </label> <div> <textarea id="services" name="services" class="element textarea medium"><?php echo $row['services']; ?></textarea> </div> </li> <li id="li_16" > <label class="description" for="element_16">Philosophy: </label> <div> <textarea id="philosophy" name="philosophy" class="element textarea medium"> <?php echo $row['philosophy']; ?> </textarea> </div> </li> <li id="li_17" > <label class="description" for="element_17">Mission Statement: </label> <div> <textarea id="mission" name="mission" class="element textarea medium"><?php echo $row['mission']; ?></textarea> </div> </li> <li id="li_18" > <label class="description" for="element_18">Customer promises above WGTF promises: </label> <div> <textarea id="customerpromises" name="customerpromises" class="element textarea medium"><?php echo $row['customerpromises']; ?></textarea> </div> </li> <li id="li_19" > <label class="description" for="element_19">Courses undertaken through WGTF: </label> <div> <textarea id="coursesundertaken" name="coursesundertaken" class="element textarea medium"><?php echo $row['coursesundertaken']; ?></textarea> </div> </li> <li id="li_20" > <label class="description" for="element_20">Other Courses: </label> <div> <textarea id="othercourses" name="othercourses" class="element textarea medium"><?php echo $row['othercourses']; ?></textarea> </div> </li> <li id="li_21" > <label class="description" for="element_21">Other non-golf Certifications: </label> <div> <textarea id="nongolfcert" name="nongolfcert" class="element textarea medium"><?php echo $row['nongolfcert']; ?></textarea> </div> </li> <li id="li_30" > <label class="description" for="element_30">CRB Checked: </label> <div> <select class="element select small" id="crbcheck" name="crbcheck"> <option value="<?php echo $row['crbcheck']; ?>" selected="selected"><?php echo $row['crbcheck']; ?></option> <option value="Yes" >Yes</option> <option value="No" >No</option> </select> </div> </li> <li id="li_31" > <label class="description" for="element_31">First Aid Certified: </label> <div> <select class="element select small" id="firstaid" name="firstaid"> <option value="<?php echo $row['firstaid']; ?>" selected="selected"><?php echo $row['firstaid']; ?></option> <option value="Yes" >Yes</option> <option value="No" >No</option> </select> </div> </li> <li id="li_22" > <label class="description" for="element_22">Latest CPD: </label> <div> <textarea id="latestcpd" name="latestcpd" class="element textarea medium"><?php echo $row['latestcpd']; ?></textarea> </div> </li> <li id="li_23" > <label class="description" for="element_23">CPD Goals: </label> <div> <textarea id="cpdgoals" name="cpdgoals" class="element textarea medium"><?php echo $row['cpdgoals']; ?></textarea> </div> </li> <li id="li_24" > <label class="description" for="element_24">Most Influential Coach or Player: </label> <div> <input id="mostinfluential" name="mostinfluential" class="element text medium" type="text" maxlength="255" value="<?php echo $row['mostinfluential']; ?>"/> </div> </li> <li id="li_25" > <label class="description" for="element_25">Main Strengths: </label> <div> <textarea id="mainstrength" name="mainstrength" class="element textarea medium"><?php echo $row['mainstrength']; ?></textarea> </div> </li> <li id="li_26" > <label class="description" for="element_26">Years' Golfing Experience: </label> <div> <input id="yeargolfexperience" name="yeargolfexperience" class="element text small" type="text" maxlength="255" value="<?php echo $row['yeargolfexperience']; ?>"/> </div> </li> <li id="li_27" > <label class="description" for="element_27">Customer Feedback Rating: </label> <div> <input id="customerfeedback" name="customerfeedback" class="element text small" type="text" maxlength="255" value="<?php echo $row['customerfeedback']; ?>"/> </div> </li> <li id="li_28" > <label class="description" for="element_28">WGTF Rating: </label> <div> <input id="wgtffeedback" name="wgtffeedback" class="element text small" type="text" maxlength="255" value="<?php echo $row['wgtffeedback']; ?>"/> </div> </li> <input type='submit' name='Submit' value='Update Profile' /> </form> <div id="footer"> </div> </div> <img id="bottom" src="bottom.png" alt=""> </body> <?php } } ?> Much appreciated
  16. Oops I see that is not meant to be there but then how will I if email is fine go through with the validation of registering the user?(which is now happening on another php page)
  17. I have a script running which will add users, although I want to check some fields like if the email is an actual email etc, and I'd like to do that clientside, ATM I've got this running but it doesn't actually check the email, and will still submit anything even if the whole form is blank, can someone help me out? <?php include "connect.php"; ?> <script type='text/javascript'> function formValidator(){ var email = document.getElementById('email'); if(emailValidator(email, "Please enter a valid email address")){ return true; } } } } } } return false; } function emailValidator(elem, helperMsg){ var emailExp = /^[\w\-\.\+]+\@[a-zA-Z0-9\.\-]+\.[a-zA-z0-9]{2,4}$/; if(elem.value.match(emailExp)){ return true; }else{ alert(helperMsg); elem.focus(); return false; } } </script> <?php if(isset($_SESSION['email'])) { ?> <form onsubmit='return formValidator()' id='register' action='addeduser.php' method='post' accept-charset='UTF-8'> <fieldset > <legend>Add User</legend> <input type='hidden' name='submitted' id='submitted' value='1'/> <label for='firstname' >First Name*: </label><br> <input type='text' name='firstname' id='firstname' maxlength="50" /><br> <label for='lastname' >Sur Name*: </label><br> <input type='text' name='lastname' id='lastname' maxlength="50" /><br> <label for='email' >Email*:</label><br> <input type='text' name='email' id='email' maxlength="50" /><br> <label for='website' >Web Site*:</label><br> <input type='text' name='website' id='website' maxlength="50" /><br> <label for='password' >Password*:</label><br><br> <input type='password' name='password' id='password' maxlength="50" /><br> <label for='address1' >Address Line 1*:</label><br> <input type='text' name='address1' id='address1' maxlength="50" /><br> <label for='address2' >Address Line 2*: </label><br> <input type='text' name='address2' id='address2' maxlength="50" /><br> <label for='city' >City / Town*: </label><br> <input type='text' name='city' id='city' maxlength="50" /><br> <label for='county' >County*:</label><br> <input type='text' name='county' id='county' maxlength="50" /><br> <label for='postcode' >Postcode*:</label><br> <input type='text' name='postcode' id='postcode' maxlength="7" /><br> <label for='sex' >Sex M/F*:</label><br> <input type='text' name='sex' id='sex' maxlength="1" /><br> <label for='dob' >Date of Birth*:</label><br> <select name="dobmonth" id="dobmonth"> <option> - Month - </option> <option value="January">January</option> <option value="Febuary">Febuary</option> <option value="March">March</option> <option value="April">April</option> <option value="May">May</option> <option value="June">June</option> <option value="July">July</option> <option value="August">August</option> <option value="September">September</option> <option value="October">October</option> <option value="November">November</option> <option value="December">December</option> </select> <select name="dobday" id="dobday"> <option> - Day - </option> <option value="1">1</option> <option value="2">2</option> <option value="3">3</option> <option value="4">4</option> <option value="5">5</option> <option value="6">6</option> <option value="7">7</option> <option value="8">8</option> <option value="9">9</option> <option value="10">10</option> <option value="11">11</option> <option value="12">12</option> <option value="13">13</option> <option value="14">14</option> <option value="15">15</option> <option value="16">16</option> <option value="17">17</option> <option value="18">18</option> <option value="19">19</option> <option value="20">20</option> <option value="21">21</option> <option value="22">22</option> <option value="23">23</option> <option value="24">24</option> <option value="25">25</option> <option value="26">26</option> <option value="27">27</option> <option value="28">28</option> <option value="29">29</option> <option value="30">30</option> <option value="31">31</option> </select> <select name="dobyear" id="dobyear"> <option> - Year - </option> <option value="2004">2004</option> <option value="2003">2003</option> <option value="2002">2002</option> <option value="2001">2001</option> <option value="2000">2000</option> <option value="1999">1999</option> <option value="1998">1998</option> <option value="1997">1997</option> <option value="1996">1996</option> <option value="1995">1995</option> <option value="1994">1994</option> <option value="1993">1993</option> <option value="1992">1992</option> <option value="1991">1991</option> <option value="1990">1990</option> <option value="1989">1989</option> <option value="1988">1988</option> <option value="1987">1987</option> <option value="1986">1986</option> <option value="1985">1985</option> <option value="1984">1984</option> <option value="1983">1983</option> <option value="1982">1982</option> <option value="1981">1981</option> <option value="1980">1980</option> <option value="1979">1979</option> <option value="1978">1978</option> <option value="1977">1977</option> <option value="1976">1976</option> <option value="1975">1975</option> <option value="1974">1974</option> <option value="1973">1973</option> <option value="1972">1972</option> <option value="1971">1971</option> <option value="1970">1970</option> <option value="1969">1969</option> <option value="1968">1968</option> <option value="1967">1967</option> <option value="1966">1966</option> <option value="1965">1965</option> <option value="1964">1964</option> <option value="1963">1963</option> <option value="1962">1962</option> <option value="1961">1961</option> <option value="1960">1960</option> <option value="1959">1959</option> <option value="1958">1958</option> <option value="1957">1957</option> <option value="1956">1956</option> <option value="1955">1955</option> <option value="1954">1954</option> <option value="1953">1953</option> <option value="1952">1952</option> <option value="1951">1951</option> <option value="1950">1950</option> <option value="1949">1949</option> <option value="1948">1948</option> <option value="1947">1947</option> <option value="1946">1946</option> <option value="1945">1945</option> <option value="1944">1944</option> <option value="1943">1943</option> <option value="1942">1942</option> <option value="1941">1941</option> <option value="1940">1940</option> <option value="1939">1939</option> <option value="1938">1938</option> <option value="1937">1937</option> <option value="1936">1936</option> <option value="1935">1935</option> <option value="1934">1934</option> <option value="1933">1933</option> <option value="1932">1932</option> <option value="1931">1931</option> <option value="1930">1930</option> <option value="1929">1929</option> <option value="1928">1928</option> <option value="1927">1927</option> <option value="1926">1926</option> <option value="1925">1925</option> <option value="1924">1924</option> <option value="1923">1923</option> <option value="1922">1922</option> <option value="1921">1921</option> <option value="1920">1920</option> <option value="1919">1919</option> <option value="1918">1918</option> <option value="1917">1917</option> <option value="1916">1916</option> <option value="1915">1915</option> <option value="1914">1914</option> <option value="1913">1913</option> <option value="1912">1912</option> <option value="1911">1911</option> <option value="1910">1910</option> <option value="1909">1909</option> <option value="1908">1908</option> <option value="1907">1907</option> <option value="1906">1906</option> <option value="1905">1905</option> <option value="1904">1904</option> <option value="1903">1903</option> <option value="1902">1902</option> <option value="1901">1901</option> <option value="1900">1900</option> </select><br><br> <label for='customerfeedback' >Customer Feedback (1-99)*:</label><br> <input type='text' name='customerfeedback' id='customerfeedback' maxlength="2" /><br> <label for='wgtffeedback' >WGTF Feedback (1-99)*:</label><br> <input type='text' name='wgtffeedback' id='wgtffeedback' maxlength="2" /><br> <input type='submit' name='Submit' value='Submit' /> </fieldset> </form> <?php } else { echo 'You can not do this if you are not logged in.'; } echo '<p><a href="index.php">home</a></p>'; ?>
  18. Thanks psycho, all working, much appreciated everyone for their help and brains
  19. I've now changed the table name users is now called user userID is now called id (also primary key) added in extra fields - all shows up but when I try to delete it gives this error: Delete Query: DELETE FROM user WHERE id IN (0) <?php include "connect.php"; //Check if records were submitted for deletion if(isset($_POST['id']) && count($_POST['id'])) { //Ensure values are ints $deleteIDs = implode(', ', array_map('intval', $_POST['id'])); $query = "DELETE FROM user WHERE id IN ({$deleteIDs})"; //Debug line echo "Delete Query: $query<br>\n"; mysql_query($query) or die(mysql_error()); } //Get any existing records to create form $query = "SELECT `id`, `firstname`, `lastname`, `email`, `website`, `password`, `address1`, `address2`, `city`, `county`, `postcode`, `sex`, `dobmonth`, `dobday`, `dobyear`, `customerfeedback`, `wgtffeedback` FROM user ORDER BY `lastname`, `firstname`"; $result = mysql_query($query) or die ( mysql_error () ); //Process results into HTML output and store in variable $userFormList = ''; while($row = mysql_fetch_array($result)) { $userFormList .= " <tr>\n"; $userFormList .= " <td>{$row['id']}</td>\n"; $userFormList .= " <td>{$row['firstname']}</td>\n"; $userFormList .= " <td>{$row['lastname']}</td>\n"; $userFormList .= " <td>{$row['email']}</td>\n"; $userFormList .= " <td>{$row['website']}</td>\n"; $userFormList .= " <td>{$row['password']}</td>\n"; $userFormList .= " <td>{$row['address1']}</td>\n"; $userFormList .= " <td>{$row['address2']}</td>\n"; $userFormList .= " <td>{$row['city']}</td>\n"; $userFormList .= " <td>{$row['county']}</td>\n"; $userFormList .= " <td>{$row['postcode']}</td>\n"; $userFormList .= " <td>{$row['sex']}</td>\n"; $userFormList .= " <td>{$row['dobmonth']}</td>\n"; $userFormList .= " <td>{$row['dobday']}</td>\n"; $userFormList .= " <td>{$row['dobyear']}</td>\n"; $userFormList .= " <td>{$row['customerfeedback']}</td>\n"; $userFormList .= " <td>{$row['wgtffeedback']}</td>\n"; $userFormList .= " <td><input type='checkbox' name='id[]' value='{$row['`id`']}' /></td>\n"; $userFormList .= " </tr>"; } mysql_close($con); ?> <html> <body> <form action="" method="POST"> <table border='0'> <tr> <th>id</th><br> <th>First Name</th><br> <th>Last Name</th><br> <th>Email</th><br> <th>Website</th><br> <th>Password</th><br> <th>Address Line 1</th><br> <th>Address Line 2</th><br> <th>city</th><br> <th>county</th><br> <th>postcode</th><br> <th>sex</th><br> <th>Date of Birth (month)</th><br> <th>Date of Birth (day)</th><br> <th>Date of Birth (year)e</th><br> <th>Customer Feedback</th><br> <th>WGTF Feedback</th><br> </tr> <?php echo $userFormList; ?> </table> <input type='submit' value='Delete Users' name='delete' /> </form> </body> </html>
  20. Thanks Psycho, I am a beginner to php and mysql but for me it seems like just getting stuck in is the best to learn, but I really appreciate your advice and read it atleast 4 times over and looking some stuff up as I wasn't sure of some things but thanks again, with the code you gave <?php include "connect.php"; //Check if records were submitted for deletion if(isset($_POST['id']) && count($_POST['id'])) { //Ensure values are ints $deleteIDs = implode(', ', array_map('intval', $_POST['id'])); $query = "DELETE FROM users WHERE id IN ({$deleteIDs})"; //Debug line echo "Delete Query: $query<br>\n"; mysql_query($query) or die(mysql_error()); } //Get any existing records to create form $query = "SELECT `id`, `firstname`, `lastname`, `location`, `email`, `website`, `userID` FROM users ORDER BY `lastname`, `firstname`"; $result = mysql_query($query) or die ( mysql_error () ); //Process results into HTML output and store in variable $userFormList = ''; while($row = mysql_fetch_array($result)) { $userFormList .= " <tr>\n"; $userFormList .= " <td>{$row['firstname']}</td>\n"; $userFormList .= " <td>{$row['lastname']}</td>\n"; $userFormList .= " <td>{$row['location']}</td>\n"; $userFormList .= " <td>{$row['email']}</td>\n"; $userFormList .= " <td>{$row['website']}</td>\n"; $userFormList .= " <td>{$row['userID']}</td>\n"; $userFormList .= " <td><input type='checkbox' name='id[]' value='{$row['id']}' /></td>\n"; $userFormList .= " </tr>"; } mysql_close($con); ?> <html> <body> <form action="" method="POST"> <table border='0'> <tr> <th>Firstname</th> <th>Lastname</th> <th>Location</th> <th>Email</th> <th>Website</th> <th>userID</th> </tr> <?php echo $userFormList; ?> </table> <input type='submit' value='Delete Users' name='delete' /> </form> </body> </html> I get an error saying: Parse error: syntax error, unexpected T_VARIABLE in /Applications/XAMPP/xamppfiles/htdocs/php/showusers2.php on line 21 I searched around and it seems to mean there is most likely a { ( etc missing and I found a ; was missing and a ; was added somewhere else by accident it seems, either way I got rid of that and now I get an error saying " Unknown column 'id' in 'field list' " Is this by any chance talking about a primary key? I have read about this and feel like I made my table wrong, I have a unique auto increment in there called userID and not an id. Appreciated
  21. Otherwise could anyone help me change the second code? I did not thought it would be this tricky to delete with checkbox
  22. No problem batwimp, and thanks pikachu, changed it all but still get the same error, I'd prefer the second block of code to work so thanks for giving some help on that one
  23. I don't think I am batwimp
  24. Ah I see I am not sure I have been doing some research about this by searching in google "deleting rows with checkbox php mysql" and been trying multiple different bits trying to incorporate it in my pathetic code, either way how can I get this to work? Thanks a lot
×
×
  • 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.