Jump to content

kev wood

Members
  • Posts

    456
  • Joined

  • Last visited

    Never

Everything posted by kev wood

  1. i am trying to select only a few values from a column depending on the selection from a drop down menu. what i want to be able to do is have the user select a title from a drop down menu which is populated from a mysql db. then once the selection has been made the user the goes to the next page where all the people's email address will be displayed who registered interest in the chosen subject from the drop down menu. at the minute my code is not exactly write as it is looking for a column with the value from the drop down menu. here is what i have so far $query="SELECT id, title FROM training WHERE 'housing'=$a"; what this line should be doing (which it does not) is select the id and title from the training table but only select the the rows which have the value of a in the housing column. hope i have made myself clear if not i will try to explain better.
  2. on the page that you want to post the values on to you will first need to catch the posted data you want. for the first and last names you have names these input box's fname and lname. at the top of the page that you want these to be displayed on you will need (inside php tags) $a = $_POST['fname']; $b = $_POST['lname']; this will then set the value of the variables to the values taken from the page before. to display the variables inside the html you will need to put this were you want them displayed <?=$a?> so this line would look as follows <div class="formCaption">First Name :<?=$a?></div>
  3. thanks for all the replies here i will mark it solved as i have got more than enough to get going with here. thanks once again for the replies.
  4. thought as much. ithanks for the reply anyway.
  5. what i want to do i am not sure if it can be done. what i want to do is have drop down menu that the user selects an option from then depending what the option was they selected the drop down menu next to it displays all the results related to that option. this section is part of the CMS side of the site. the site has different categories the user can register there interest in but also these categories have sub sections. when a user registers there details they leave there email address. this section will be used to get all there emails address into a CSV format so the user can then email them information on the chosen category and subject. so what i want this section to do is give the user the option to select the categories from the first drop down menu then all the sub categories will populate the second drop down menu depending on the first selection. i know this can be easily done using submit buttons and only having one drop down menu per page but i would like it done with now submit button if possible. once the user has selected the category and subject then they will submit the information to get the results on a new page with just the email addresses on. all the information is stored on the server in mysql db's.
  6. i have my content being loaded into a div tag and everything is working great. all my forms are working and submit the data to the mysql db's but i have a page whih has a list of useful links on it and the links will not work. they are being underlined as if they were an active link when the mouse moves over them but when they are clicked nothing happens. if any of the code needs posting let me know.
  7. i have created a website which loads the page content into a div tag. the problem i am having is that two sections of the content are forms and i would like to have some form validation on these but everything i have tried up to now has failed. the code i have so far is as follows the head section function validateFormOnSubmit(sub_form) { var reason = ""; reason += validateFirstname(theForm.fname); reason += validateSurname(theForm.lname); reason += validateEmail(theForm.email); if (reason != "") { alert("Some fields need correction:\n" + reason); return false; } return true; } function validateFormOnSubmit(interest) { var reason = ""; reason += validateFirstname(theForm.radio); reason += validateSurname(theForm.name); reason += validateEmail(theForm.address); reason += validateEmail(theForm.housing); reason += validateEmail(theForm.email); if (reason != "") { alert("Some fields need correction:\n" + reason); return false; } return true; } this code is in the head section of the index page which has all the code loaded into it. i have set the code out with the names of the forms in the brackets at the end of the function line so it would only use the correct validation for each form. i am not sure that this is correct though. and the code for the forms is as follows case 9: echo '<form name="sub_form" action="i*******.php" onsubmit="return validateFormOnSubmit(this)" method="POST"> <h4>Select what page you would like notifying about on update</h4> <select name="radio"> <option value="news">News Article</option> <option value="training">Training Opportunities</option> <option value="events">Event</option> </select> <br /><br /><h4>Enter the required information</h4> <b>First Name:</b><br /> <input type="text" name="fname" /><br /> <b>Last Name:</b><br /> <input type="text" name="lname" /><br /> <b>Email:</b><br /> <input type="text" name="email" /><br /> <br /> <input type="submit" value="Add subscription" /> </p> </form>'; break;
  8. you will need to resize the images that are uploaded also in a way that they are not distorted. i have a php image upload script which resizes the image without distorting it and stores the url to the image in a db and also stores to copies of it on the server. would you like this script?
  9. does your table have a column which has the title id and is set to auto increment. if you have then you are already giving each row a unique id and this should be used to display unique rows from the table.
  10. sorted. i have to just echo the options as follows echo $options
  11. i have the following code which populates a drop down menu with query results from a mysql db. i got the page working fine. i have now change the way the page so that it loads the content into a div tag but since i have done this the code is no longer populating the drop down menu. here is all the code for the contnet which is loaded in the div tag case 10: echo''; $db = "pipdb"; $con = mysql_connect("localhost","pip","piptables")or die(mysql_error()); mysql_select_db($db)or die(mysql_error()); $query="SELECT id, title FROM training"; $result = mysql_query($query) or die(mysql_error()); $options = ""; while ($row=mysql_fetch_array($result)) { $id = $row['id']; $title = $row['title']; $options.="<OPTION VALUE=\"$id\">".$title; } echo'<form action=\"insert_interest.php\" method=\"POST\"> <h4>Select which course you would like to register your interest in</h4> <h5>Option 1</h5> <select name=\"radio\"> <OPTION VALUE=0>Please select an option <?=$options?> </select> <h5>Option 2</h5> (only select more options if needed)<br /> <br /> <select name="radio1"> <OPTION VALUE=0>Please select an option <?=$options?> </select> <h5>Option 3</h5> <select name="radio2"> <OPTION VALUE=0>Please select an option <?=$options?> </select> <br /><br /><h4>Enter the required information</h4> <b>Name:</b><br /> <input type="text" name="name" /><br /> <b>Address:</b><br /> <textarea cols="50" rows="7" name="address" onkeyup="textLimit(this, 150);"></textarea><br /> <b>Housing Association:</b><br /> <input type="text" name="housing" /><br /> <b>Email:</b><br /> <input type="text" name="email" /><br /> <br /> <input type="submit" value="Register Interest" /> </p> </form>'; break; this is the section of code that is not working anymore <h5>Option 1</h5> <select name=\"radio\"> <OPTION VALUE=0>Please select an option <?=$options?> </select>
  12. removed the centre from the table and the scrollbar has now appeared???????????? anybody know why this happens?
  13. if you want the height of the iframe to be set to 600 then change this line of code <iframe src="home.php" scrolling="auto" width="100%" height="600%" frameborder="0"></iframe> to this <iframe src="home.php" scrolling="auto" width="100%" height="600px" frameborder="0"></iframe>
  14. thought it might have been a problem with it bein html being sent from a php page
  15. i have these two pages of information which are stored on a php page which then feeds the main div tag on the index page. the problem i have here is that a scrollbar shows up on the first page but not the second. so to see the rest of the information on the page the user needs to click iun the div and scroll with the mouse or the arrow keys. i cannot work out for the life of me why this is happening (and i know it is prob starring right at me with two fingers up laughing) here is the code for the page were the scrollbar is visible and works case 2: echo ''; $db = "pipdb"; $con = mysql_connect("localhost","***","*******")or die(mysql_error()); mysql_select_db($db)or die(mysql_error()); $result = mysql_query("SELECT * FROM ***** ORDER BY id DESC") or die(mysql_error()); echo "<div style=\"height: 500px; width: 450px; overflow:auto;\">"; echo "<table width=350px border=0>\n"; // keeps getting the next row until there are no more to get while($row = mysql_fetch_array( $result )) { // Print out the contents of each row into a table echo "<tr><td>"; echo $row['date']; echo "</td></tr>"; echo "<tr><td><b>"; echo $row['title']; echo "</b></td></tr>"; echo "<tr><td>"; if(!empty($row['image'])) { echo '<img src="images/'.$row['image'].'">'; } echo $row['article']; echo "</td></tr>"; echo"<tr><td> </tr></td>"; } echo "</table>"; echo "</div>"; break; and the code where the scrollbar is not visible case 8: echo "<div style=\"height: 500px; width: 300px; overflow:auto;\">"; echo'<table width=100% border=0 align="center"> <tr> <td><h2><b>Cobalt Housing</b></h2> Cobalt Housing<br /> Cobalt Housing<br /> Cobalt Housing<br /> Cobalt Housing<br /> Cobalt Housing<br /> Cobalt Housing<br /> <br /> <b>Tel :</b>Cobalt Housing<br /> <b>Fax :</b>Cobalt Housing<br /> <b>Email :</b> <a href="mailto:Cobalt Housing?subject=Enqiry from PiP website">Cobalt Housing</a> </td> </tr> <tr> <td> </td> </tr> <tr> <td><h2><b>LHT</b></h2> LHT<br /> LHT<br /> LHT<br /> LHT<br /> LHT<br /> LHT<br /> <br /> <b>Tel :</b>LHT<br /> <b>Fax :</b>LHT<br /> <b>Email :</b> <a href="mailto:LHT?subject=Enqiry from PiP website">LHT</a> </td> </tr> <tr> <td> </td> </tr> <tr> <td><h2><b>LMH</b></h2> LMH<br /> LMH<br /> LMH<br /> LMH<br /> LMH<br /> LMH<br /> <br /> <b>Tel :</b>LMH<br /> <b>Fax :</b>LMH<br /> <b>Email :</b> <a href="mailto:LMH?subject=Enqiry from PiP website">LMH</a> </td> </tr> <tr> <td> </td> </tr> <tr> <td><h2><b>Plus Dane Group</b></h2> Plus Dane Group<br /> Plus Dane Group<br /> Plus Dane Group<br /> Plus Dane Group<br /> Plus Dane Group<br /> Plus Dane Group<br /> <br /> <b>Tel :</b>Plus Dane Group<br /> <b>Fax :</b>Plus Dane Group<br /> <b>Email :</b> <a href="mailto:Plus Dane Group?subject=Enqiry from PiP website">Plus Dane Group</a> </td> </tr> <tr> <td> </td> </tr> <tr> <td><h2><b>The Regenda Group</b></h2> The Regenda Group<br /> The Regenda Group<br /> The Regenda Group<br /> The Regenda Group<br /> The Regenda Group<br /> The Regenda Group<br /> <br /> <b>Tel :</b>The Regenda Group<br /> <b>Fax :</b>The Regenda Group<br /> <b>Email :</b> <a href="mailto:The Regenda Group?subject=Enqiry from PiP website">The Regenda Group</a> </td> </tr> <tr> <td> </td> </tr> <tr> <td><h2><b>SLH Group</b></h2> SLH Group<br /> SLH Group<br /> SLH Group<br /> SLH Group<br /> SLH Group<br /> SLH Group<br /> <br /> <b>Tel :</b>SLH Group<br /> <b>Fax :</b>SLH Group<br /> <b>Email :</b> <a href="mailto:SLH Group?subject=Enqiry from PiP website">SLH Group</a> </td> </tr> <tr> <td> </td> </tr> <tr> <td><h2><b>Venture</b></h2> Venture<br /> Venture<br /> Venture<br /> Venture<br /> Venture<br /> Venture<br /> <br /> <b>Tel :</b>Venture<br /> <b>Fax :</b>Venture<br /> <b>Email :</b> <a href="mailto:Venture?subject=Enqiry from PiP website">Venture</a> </td> </tr> <tr> <td> </td> </tr> </table> </div>'; break; i know the things displayed are slightly different but this shouldnt matter should it?
  16. i am loading page content into a div tag using javascript and php but the title section of the site is not held in the div. so this means that i am left with th esame title on each page. i thought i would be able to a similar image swap with it as is done with a roll-over but this has not worked. here is the code i have so far the functions in the head function loadContent(id) { $("#contentArea").load("rpc.php?o="+id+""); } function roll(img_name, img_src) { document[img_name].src = img_src; } function click(img_name, img_src) { document[img_name].src = img_src; } and the code on the button is <a href="javascript:loadContent(1);" onmouseover="roll('about_but', 'buttons/about_but2.png')" onmouseout="roll('about_but', 'buttons/about_but.png')" onmousedown="click('title_img', 'assets/homeP_title.png')" onmouseup="click('title_img', 'assets/aboutP_title.png')"><img src="buttons/about_but.png" name="about_but" border="0" align="left"/></a>[code] any help would be much appreciated.
  17. sorry i got side tracked yesterday i will put it to the test today. to be honest tho i thought that would do it ne way and went to implement it then had to leave the computer to do other stuff will get bak today tho and mark the solved button it if works.
  18. yes the upload works by storing the file on the server and witting the path to it to a db. thank for the reply anyway.
  19. i have a cms built where the user is able to upload an image to go with a story if they want to. the problem that i am hving is that if they choose not to upload an image i get a red cross can stop this from happening
  20. you need to use the where clause of a mysql statement. the following statement will search through a db for a specific value held by the variable $table $query = "SELECT * FROM emails WHERE page = '$table'"; the column name is page and the variable holds the value to search for although this does not have to be a variable.
  21. also remember if you are sending to more than one user to put all the address in the BCC so only the persons email address shows up in there inbox and they cannot see everyones email address it was sent to.
  22. change what you need in this and use this code it works fine for me. $message .= '<body leftmargin="0" topmargin="0"> <table width="700" border="0" align="center" cellpadding="0" cellspacing="5"> <tr> <td>The ' . $table . ' section of the <a href="piponline.info"> PiPonline website</a> has been updated. Please follow the link to see the new content. </tr> </table> </body>'; $query = "SELECT * FROM emails WHERE page = '$table'"; $result = mysql_query($query) or die(mysql_error()); while($row = mysql_fetch_assoc($result)) { $contactemail = $row['email']; // Contacts //$replyName = $merc_replyId; //$replyEmail = $merc_replyAddress; $replyName = "PiPonliine"; $replyEmail = "info@piponline.info"; $contactname = ""; // Subject $subject = "Website Update"; // Headers $headers = "MIME-Version: 1.0" . PHP_EOL; $headers .= "Content-type: text/html; charset=iso-8859-1" . PHP_EOL; $headers .= "From: ".$replyName." <".$replyEmail.">" . PHP_EOL; $headers .= "BCC: ".$contactname." <".$contactemail.">\r\n" . PHP_EOL; mail($contactemail, $subject, $message, $headers); } as you can see from my script i am pulling all the email address details from a mysql db. that bit can be taken out or changed to match up with your db if you have it set that way or just take that section out and change this line $headers .= "BCC: ".$contactname." <".$contactemail.">\r\n" . PHP_EOL; to just hold the email address you want the mail sent to .
×
×
  • 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.