Jump to content

gum1982

Members
  • Posts

    69
  • Joined

  • Last visited

    Never

Everything posted by gum1982

  1. Hi People I have got the following code which querys the db $tsql = $wpdb->prepare( "SELECT sd.user_id FROM {$specialisms_data_table} sd WHERE sd.field_id = {$specialising_field_id} AND sd.value LIKE %s", $specialism); $data = $wpdb->get_results( $tsql ); echo "<pre>"; print_r($data); echo "</pre>"; The output for the print_r($data); Array ( [0] => stdClass Object ( [user_id] => 42 ) [1] => stdClass Object ( [user_id] => 46 ) ) I then want to loop through these ids and then outputs some off the required db fields. So i am trying to do this with a foreach loop but its not returning me with anything. <?php foreach( $data as $value ) { ?> <?php echo $value; ?> <?php } ?> I am not getting any results any help what am i doing wrong?
  2. Brilliant thanks guys worked a treat
  3. Hi Guys Ive got a form as follows, <form method="post" action="<?php bloginfo("template_url"); ?>/process-discounted.php"> <table width="320" border="1"> <tr> <td><input type="checkbox" class="small" value=".co.uk" name="dom[]" />.co.uk</td> <td><input type="checkbox" class="small" value=".com" name="dom[]" />.com</td> <td><input type="checkbox" class="small" value=".org" name="dom[]" />.org</td> <td><input type="checkbox" class="small" value=".org.uk" name="dom[]" />.org.uk</td> </tr> <tr> <td><input type="checkbox" class="small" value=".net" name="dom[]" />.net</td> <td><input type="checkbox" class="small" value=".tv" name="dom[]" />.tv</td> <td><input type="checkbox" class="small" value=".biz" name="dom[]" />.biz</td> <td><input type="checkbox" class="small" value=".mobi" name="dom[]" />.mobi</td> </tr> <tr> <td><input type="checkbox" class="small" value=".me" name="dom[]" />.me</td> <td><input type="checkbox" class="small" value=".me.uk" name="dom[]" />.me.uk</td> <td><input type="checkbox" class="small" value=".eu" name="dom[]" />.eu</td> <td><input type="checkbox" class="small" value=".info" name="dom[]" />.info</td> </tr> </table> <p> <input class="submit" type="submit" id="submit" name="submit" value="submit"/> </p> </fieldset> </form> This is my process.php $aDoor = $_POST['dom']; $N = count($aDoor); for($i=0; $i < $N; $i++) { $domains = ($aDoor[$i] . " "); } include "MIME.class"; $to = 'example@hotmail.com'; $str = "Domains ".date('M Y', time()); $html_data = '<html lang="en"> <head> <title>Template 2 :: Versatile Newsletter</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> </head> <body leftmargin="0" marginwidth="0" topmargin="0" marginheight="0" offset="0" bgcolor="#F0F0F0"> <table cellpadding="0" cellspacing="0" width="720" align="center"> <tr> <td width="250">Domains:</td> <td width="250">'.$domains.'</td> </tr> </table> <br /> <br><br></td></tr> </table> </td></tr></table><!-- end wrapper table--> </body> </html>'; $mime = new MIME_mail("Discounted Hosting", $to, $str); $mime->attach($html_data, "", HTML, BASE64); $mime->send_mail(); } ?> This echos out the boxes checked which is fine but i need to send all the values in a email. how can i send these value in the email currently i only always get one value i need them to be broken up. any help please
  4. Hi ym_chaitu thanks for the reply i wanted to form to validate first, then if their is no validation errors it will run the simple header redirect at the top off the header.php, <?php if(isset($_POST['submit'])){ header("http://gponeclick.users32.interdns.co.uk/thankyou.php"); } ?> Obviously i will be running more than this but i would like to get it working up to this point???
  5. Hi ym_chaitu This is the sidebar code. <h2 class="donate">donate <span>online today</span></h2> <form id="formID" class="formular" method="post" action=""> <fieldset> <ol> <li> <input value="First Name:" onfocus="this.value = (this.value=='First Name:')? '' : this.value;" class="validate[required,custom[onlyLetter],length[0,100]] text-input" type="text" name="firstname" id="firstname" /> </li> <li> <input value="Last Name:" onfocus="this.value = (this.value=='Last Name:')? '' : this.value;" class="validate[required,custom[onlyLetter],length[0,100]] text-input" type="text" name="lastname" id="lastname" /> </li> <li> <input value="Email address:" onfocus="this.value = (this.value=='Email address:')? '' : this.value;" class="validate[required,custom[email]] text-input" type="text" name="email" id="email" /> </li> <li> <input type="text" value="Address 1:" onfocus="this.value = (this.value=='Address 1:')? '' : this.value;" class="validate[required,custom[onlyLetter],length[0,100]] text-input" name="address1" id="address1" /> </li> <li> <input type="text" name="address2" value="Address 2:" onfocus="this.value = (this.value=='Address 2:')? '' : this.value;" class="text"/> </li> <li> <input type="text" value="Town:" onfocus="this.value = (this.value=='Town:')? '' : this.value;" class="validate[required,custom[onlyLetter],length[0,100]] text-input" name="town" id="town" /> </li> <li> <input type="text" value="Postcode:" onfocus="this.value = (this.value=='Postcode:')? '' : this.value;" name="postcode"/> </li> <li> <input value="Telephone:" onfocus="this.value = (this.value=='Telephone:')? '' : this.value;" class="validate[required,custom[telephone]] text-input" type="text" name="phone" id="phone" /> </li> </ol> </fieldset> <fieldset class="check"> <div class="campaign"> <input class="validate[required] radio" type="radio" name="data[user][preferedColor]" id="radio1" value="5"/> <label><span>£1</span><br /> a month</label> </div> <div class="campaign"> <input class="validate[required] radio" type="radio" name="data[user][preferedColor]" id="radio2" value="3"/> <label><span>one-off</span> donation</label> </div> <div class="campaign"> <input class="validate[required] radio" type="radio" name="data[user][preferedColor]" id="radio3" value="9"/> <label><span>regular</span> donation</label> </div> </fieldset> <div id="onelife"> <div class="container2"> thankyou you for choosing our one life campaign click next step to proceed to payment.</div> </div> <div id="monthly"> <div class="container2"> <h4>Please select a monthly amount from list</h4> <label class="monthly">£5 Monthly</label> <input class="monthly" type="checkbox" name="five" /> <div class="clear"></div> <br /> <label class="monthly">£10 Monthly</label> <input class="monthly" type="checkbox" name="first" /> <div class="clear"></div> <br /> <label class="monthly">£20 Monthly</label> <input class="monthly" type="checkbox" name="second" /> <div class="clear"></div> <br /> <label class="monthly">£30 Monthly</label> <input class="monthly" type="checkbox" name="30" /> <div class="clear"></div> <br /> <label class="monthly">£40 Monthly</label> <input class="monthly" type="checkbox" name="40" /> </div> </div> <div id="oneoff"> <div class="container2">Thanks for choosing to make a one off donation click next step to proceed to payment.</div> </div> <img class="gift" src="http://gponeclick.users32.interdns.co.uk/wp-content/themes/Going-Public/images/gift-aid.png" width="300" height="38" alt="gift aid" /> <fieldset class="giftaid"> <input type="checkbox" id="giftaid" title="Please agree to our policy!" name="giftaid" class="{validate:{required:false}}" /> <p class="giftaid"> I would like Going Public to reclaim the tax I have paid on this donation, any donation I have made in the six years prior to this year, and any donations I may make in the future. I am a UK taxpayer.</p> <br /> </fieldset> <fieldset class="terms"> <input title="Please agree to our policy!" class="validate[required] checkbox" type="checkbox" id="agree" name="agree"/> <p class="giftaid">I agree to be added to the Going Public email database.</p> </fieldset> <fieldset class="submit"> <input class="submit" type="submit" value="Validate & Send the form!"/> </fieldset> </form> </div> And here is the main header.php. <?php if(isset($_POST['submit'])){ header("http://gponeclick.users32.interdns.co.uk/thankyou.php"); } ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title><?php bloginfo('description') ?></title> <meta name="description" content="<?php bloginfo('description') ?>" /> <?php if(is_search()) { ?> <meta name="robots" content="noindex, nofollow" /> <?php }?> <link rel="stylesheet" type="text/css" href="<?php bloginfo('stylesheet_url'); ?>" media="screen" /> <link rel="stylesheet" type="text/css" href="<?php bloginfo('template_url'); ?>/style/css/validationEngine.jquery.css" /> <link rel="alternate" type="application/rss+xml" title="<?php bloginfo('name'); ?> RSS Feed" href="<?php bloginfo('rss2_url'); ?>" /> <link rel="pingback" href="<?php bloginfo('pingback_url'); ?>" /> <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.1/jquery.min.js"></script> <script src="<?php bloginfo("template_url"); ?>/js/jquery.validationEngine-en.js" type="text/javascript"></script> <script src="<?php bloginfo("template_url"); ?>/js/jquery.validationEngine.js" type="text/javascript"></script> <script type="text/javascript"> $(document).ready(function() { //Hide div w/id extra $("#onelife").css("display","none"); // Add onclick handler to checkbox w/id checkme $("#radio-1").click(function(){ // If checked if ($("#radio-1").is(":checked")) { //show the hidden div $("#onelife").show("fast"); } else { //otherwise, hide it $("#onelife").hide("fast"); } }); $("#monthly").css("display","none"); // Add onclick handler to checkbox w/id checkme $("#radio-2").click(function(){ // If checked if ($("#radio-2").is(":checked")) { //show the hidden div $("#monthly").show("fast"); } else { //otherwise, hide it $("#monthly").hide("fast"); } }); $("#oneoff").css("display","none"); // Add onclick handler to checkbox w/id checkme $("#radio-3").click(function(){ // If checked if ($("#radio-3").is(":checked")) { //show the hidden div $("#oneoff").show("fast"); } else if ($("#radio-3").is(":unchecked")) { //otherwise, hide it $("#oneoff").hide("fast"); } }); }); </script> <script src="<?php bloginfo("template_url"); ?>/jquery.easing.1.3.js" type="text/javascript"></script> <script src="<?php bloginfo("template_url"); ?>/js/coda-slider-condensed.js" type="text/javascript" charset="utf-8"></script> <script type="text/javascript"> $(function() { $('.scrollButtons.left').hover(function() { var currentImg = $(this).attr('src'); $(this).attr('src', $(this).attr('hover')); $(this).attr('hover', currentImg); }, function() { var currentImg = $(this).attr('src'); $(this).attr('src', $(this).attr('hover')); $(this).attr('hover', currentImg); }); $('.scrollButtons.right').hover(function() { var currentImg = $(this).attr('src'); $(this).attr('src', $(this).attr('hover')); $(this).attr('hover', currentImg); }, function() { var currentImg = $(this).attr('src'); $(this).attr('src', $(this).attr('hover')); $(this).attr('hover', currentImg); }); }); </script> <?php wp_head(); ?> <script type="text/javascript"> $(document).ready(function() { // SUCCESS AJAX CALL, replace "success: false," by: success : function() { callSuccessFunction() }, $("#formID").validationEngine() //$.validationEngine.loadValidation("#date") //alert($("#formID").validationEngine({returnIsValid:true})) //$.validationEngine.buildPrompt("#date","This is an example","error") // Exterior prompt build example // input prompt close example //$.validationEngine.closePrompt(".formError",true) // CLOSE ALL OPEN PROMPTS }); </script> </head> <body> <div id="header" class="large"> <h1><a href="<?php echo get_option('home'); ?>/"> <?php bloginfo('name'); ?> </a></h1> <div id="search_box"> <?php get_search_form(); ?> </div> <!-- end search box --> <a class="sign" href="#">Sign</a> </div> <div id="menu" class="large"> <ul> <?php wp_list_pages('title_li='); ?> </ul> </div>
  6. Hi I have got a problem with the validation on my site. I cant seem to solve the problem. Every time i hit submit on my form, the form starts to validate but then refreshes. You can see my problem here. http://gponeclick.users32.interdns.co.uk/ I have got a form on my site that is submitting to an action of nothing. <form id="formID" class="formular" method="post" action=""> Has anyone had a similar problem or can give me some sort off reason why it would be doing this. The form is in a sidebar_all.php and is included in the index.php <div class="column"> <?php include (TEMPLATEPATH . "/sidebar_all.php"); ?> </div> I have deleted this and inserted all the form code into the index.php and it is still causing the problem. Anyone help please???
  7. Ok thanks WolfRage for the reply i will look into this first. because its a charity im trying to figure out the following. Originator's Identification Number: Giftaid: UK taxpayer: Anyone done any stuff for charities that could help? thanks
  8. Hi Really need some help please, im was setting up a donation form for a charity which went to paypal for them to setup a direct debit payment which was fine. My problem is they don't want to use paypal anymore they want people to be able to set-up a direct debit directly through the website. I have never done this before and have nearly always used paypal does anyone now any good resources on setup a direct debit payment. Any help would be great just looking for a starting point. Could i make it from scratch with php?
  9. Hello can someone please help me im running a foreach loop that is pulling the prices value out off my database as follows. this is the function function one_life() { db_connect(); $query = "SELECT * FROM paypal_payment_info order by paypal_payment_info.mc_gross DESC"; $result = mysql_query($query); if(!$result) { echo mysql_error(); } $result = db_result_to_array($result); return $result; } $one_lifes = one_life(); This is my foreach loop <?php foreach($one_lifes as $one_life) { ?> <?php echo $one_life['mc_gross']; ?> <?php } ?> So this gives me the values i have a list like this. 200 10 30 200 350 What i need to do is add all these values together and echo one overall amount which would be say 790 for the example. Any Help Please?
  10. thanks for the reply So if i add this ("^[[a-zA-Z]{2}\s[0-9]{4}]$") does this mean that both possible codes would work? ie as1233 or as 1233
  11. Can someone please help me. Ive done this regular expression which works out as any code that starts with two letters and ends with four numbers. i.e as1233 Im not very good with regular expressions all i want is it to allow spaces because the company has hand out the code to every as two letters SPACE and ends with four numbers. ie as 1233 Here my regular expression ("^[[a-zA-Z]{2}[0-9]{4}]$") i see that \s strips whitespace but dont now how to implement this. Any help Please?
  12. Hey that did the job good for what i needed thanks premiso
  13. Ok thanks cheers for the reply.
  14. Hello i am not sure if this is a JavaScript question or a php question so sorry first. Here is my problem i have a survey which is really long so you have to scroll down the page right to the bottom after filling it out and then clicking submit, the survey scrolls all the way to the top again i really don't want this to happen. After it has been submited i want it to scroll dynamically to the bottom. here is some of my code. <FORM METHOD="post" ACTION="" id="check"> <table> //whole survey form here// </table> <table> <input type="submit" name="signup" id="submit_btn" value="" /> </table> if(isset($_POST[signup])){ /////////////////////////////////////////////////////////////////////////// echo "<script langauge=\"javascript\">alert(\"Thank you We've received your Business Check. We will get back to you shortly!\");</script>"; } How can i run some code after the alert to send the user to the bottom off the page can someone please tell me what is the best way to do this????
  15. Can someone please tell me why my header redirect isnt working. The field created_at is just pulling a field out off the database i haven't added this code. If i put echo "expired"; instead off the header redirect that outputs fine $exp_date = $field['created_at']; echo "Database ".$exp_date.'<br />'; $todays_date = date("Y-m-j H:i:s"); echo "Today ".$todays_date.'<br />'; $expiration_date = strtotime($exp_date); echo "Database ".$expiration_date.'<br />'; $today = strtotime($todays_date); echo "Today ".$today.'<br />'; if ($expiration_date > $today) { echo "Welcome"; } else { header("Location: http://www.example.com/"); exit; }
  16. Has anyone wrote a script for online tickets sales? I have been googling and found lots of third party solutions. I was hoping to adapt a digital goods sale script. Is it possible to have a ticket sent via email or does it make more sense to have a downloadable link sent to the email where they can download the ticket. How does online ticket sales work when setting it up with php what processes for the delivery off ticket are taken. Has anyone done this before and can give me some advice please??
  17. Brilliant this is great information thanks, i will try and report back.
  18. ok so i have set a field in the database that stores the unique url and the time it was created, so if i run a loop on the database this is what it returns. http://www.example.com/survey.php?formid=1258561238-21611319133 2009-11-18 16:20:34 http://www.example.com/survey.php?formid=1258561141-21611319133 2009-11-18 16:18:57 http://www.example.com/survey.php?formid=1258560211-21611319133 2009-11-18 16:03:27 Do i need to setup a cronjob to query the the database. So when date.id = + 28 days it makes the link void. Is this the right process or am i miles out. Also how would i effect the link in their email as i am only altering the link in the database??
  19. Ok thanks for the reply i am in the process off trying to set this up ill let you know how i get on.
  20. Hi all I have setup my script through paypal ipn so that after the payment has been processed it sends a unique url to the customers email. This is the script if the payment is Verified!! $email = $_POST['payer_email']; $url = "http://www.example.com/survey.php?formid=" . urlencode($formid); $to = $email; $str = "Survey".date('M Y', time()); $html_data = '<html> <head> <title> Survey </title> </head> <body bgcolor="#fff0ff" text="#0000ee"> Thank you for your purchase Your account information Email: '.$email.' Direct Link to Survey: <a href='.$url.'>Link To Survey.</a> </body></html>'; $mime = new MIME_mail("Survey", $to, $str); $mime->attach($html_data, "", HTML, BASE64); $mime->send_mail(); } Ok so this works fine and sends the link with the url to the survey. But the client has said that he wants the link to become unusable after 28 days is this possible and where would i set the script up for this. Any Help Please People??
  21. How can i make it impossible for someone to just put a url to my php page. i want to put some sort off protection on a file. I have got a file called survey.php in my site directory what method do i use to stop someone just being able to get to get to that page by typing www.example.com/survey.php in the address? I only want this page to be access after a form has been filled out. What method do i use to do this? thanks
  22. Hi Cags Yeah this is my full code. I do have those two lines is this causing the problem? <?php include_once("lib/get-response.php"); define('DEBUG', true); // change this to true to control debug output, or false function add_to_GetResponse($name, $email, $custom) { // key data $api_key = '!!!!!!!!!!!!!!!!!!!!!!!!!!!!!'; $campaign = '!!!!!!!!!!!!!!!!!!'; $ref = "000"; // optional, may be null $ip = $_SERVER['REMOTE_ADDR'];//"123.123.123.123"; // optional, may be null // add to GetResponse addSubscriberGET($api_key, $campaign, $email, $name, $ref, $ip, $custom); } $first = htmlspecialchars($_POST['name']); $email = htmlspecialchars($_POST['email']); if(isset($_POST['submit'])){ if(trim($_POST[name]) == '') { //$error = "Please enter your name!"; } elseif(trim($_POST[email])==''){ //$error = "An email address is required!"; } elseif(!eregi("^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$", $_POST[email])) { //$error = "The e-mail you entered was not in the proper format!"; } elseif(!isset($_POST['check'])) { //$error = "Would you like to tick the box so we can send you the MOT?"; } elseif (add_to_GetResponse($name, $email, null/*custom*/) === false) { // Debug error - you can decide what to do on error if (DEBUG) $error = "Their was an error adding your data"; } else { session_start(); $_SESSION['name'] = $first; $_SESSION['email'] = $email; $_SESSION['telephone'] = $telephone; session_write_close(); header('location: http://www.page2.php'); } } ?> <html> <form id="mot" class="formular" action="" method="post"> <h2>Free Business MOT Sign-up</h2> <?php //echo "<span style=color:red>$error</span>"; ?> <fieldset> <legend>Your Details</legend> <label> First name <input value="<?php echo $_POST['name']; ?>" type="text" name="name" id="name" /> </label> <label> Email address : <input value="<?php echo $_POST['email']; ?>" type="text" name="email" id="email" /> </label> <label> Telephone : <input value="<?php echo $_POST['telephone']; ?>" type="text" name="telephone" id="telephone" /> </label> <label> <span class="checkbox">I am happy to recieve mail : </span> <input type="checkbox" id="agree" name="agree" value="1" <?php if(isset($_POST['check']) == 1) { echo 'unchecked="unchecked"'; } ?> /> </label> <input class="submit" type="submit" name="submit" value="Sign Up"/> </fieldset> </form> </html
  23. Hi Cags The only problem ive got with that is i have done all my php validation at the top of this page so it runs the validation then redirects. if(isset($_POST['submit'])){ if(trim($_POST[name]) == '') { //$error = "Please enter your name!"; } elseif(trim($_POST[email])==''){ //$error = "An email address is required!"; } elseif(!eregi("^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$", $_POST[email])) { //$error = "The e-mail you entered was not in the proper format!"; } elseif(!isset($_POST['check'])) { //$error = "Would you like to tick the box so we can send you the MOT?"; } elseif (add_to_GetResponse($name, $email, null/*custom*/) === false) { // Debug error - you can decide what to do on error if (DEBUG) $error = "Their was an error adding your data"; } else { session_start(); $_SESSION['name'] = $first; $_SESSION['email'] = $email; $_SESSION['telephone'] = $telephone; session_write_close(); header('location: http://www.page2.php'); }
×
×
  • 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.