wmguk Posted March 9, 2010 Share Posted March 9, 2010 Hi, I have a competition page however for some reason when I submit the answers it enters them in the DB but doesnt thank the user for contacting us. www.snippa.co.uk/u7sh I dont want to post the code unless someone asks, only as there is no much! and I dont want to spam the post Link to comment https://forums.phpfreaks.com/topic/194616-no-thank-you-message-after-submittion/ Share on other sites More sharing options...
trq Posted March 9, 2010 Share Posted March 9, 2010 Once your data has been submitted to the database you will need to redirect the user to a thankyou page. The can be done using.... header("Location: http://yoursite.com/thankyou.php"); Link to comment https://forums.phpfreaks.com/topic/194616-no-thank-you-message-after-submittion/#findComment-1023541 Share on other sites More sharing options...
wmguk Posted March 9, 2010 Author Share Posted March 9, 2010 ok, this is the code I have at the moment, <? require_once('../lib/config.php'); require_once('class.competition_entry.php'); base::warning("Competition Entry"); $entry_url="http://snippa.co.uk/".base::constant('COMP_URL'); if($_POST) { #show($session); foreach(array('terms',) as $k) { if(!$_POST[$k]) $errors[$k]='Required'; } foreach(array('first_name','last_name','email','password',) as $k) { if($_POST[$k]) $uinf[$k]=$_POST[$k]; else $errors[$k]='Required'; } if(!$errors) { if($u=user::email_exists($uinf['email'])) { $errors['email']='Already Registered'; } } if(!$errors) { $user->save($uinf); $user->login($uinf['email'],$uinf['password'],true); print "Post-Login:";show($session); } if(!$errors) { $entry=$_POST['entry']; foreach($entry as $i => $item) { $entry[$i]=substr($item,0,35); } do { $url=chr(rand(97,122)).substr(md5(rand()),0,3); } while(($ce=new competition_entry($url)) and $ce->id()); $ce=new competition_entry(); $cinf=array( 'user_id'=>$user->id(), 'entry'=>$entry, 'url'=>$url, ); $ce->save($cinf); } if(!$errors) { $_SESSION['competition']['entered']=1; header('Location: /'.$url); exit; } } if($user->loggedin()) { $user->logout(); header('Location: '.$_SERVER['REQUEST_URI']); exit; } ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"> <head> <base href="http://snippa.co.uk/competition/" /> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>SnippaLondon</title> <link href="css/all.css" rel="stylesheet" type="text/css" media="all" /> <!--[if lt IE 7]> <link rel="stylesheet" type="text/css" href="css/lt7.css" media="screen"/> <script type="text/javascript" src="js/png-fix.js"></script> <![endif]--> <!--[if IE]><link rel="stylesheet" type="text/css" href="css/ie.css" media="screen"/><![endif]--> <? if($errors) { ?> <script>document.location='#entryform';</script> <? } ?> </head> <body> <div id="wrapper"> <div class="wrapper-holder"> <h1 class="logo"><a href="#"><span>Snippa London</span></a></h1> <div id="main"> <ul id="nav"> <li><a href="../">Current Deals</a></li> <li><a href="../home/howitworks/">How Snippa Works</a></li> <!-- <li><a href="#">Change Location</a></li> --> <!-- <li><a href="#" class="daily-updates-social">Daily Updates</a></li> --> <li><a href="../home/business/">Snippa For Business</a></li> <li><a href="http://snippa.co.uk/competition/enter">Competition</a></li> <li><a href="../home/contact/">Contact Us</a></li> </ul> <div id="content"> <div class="content-holder"> <div class="content-t"></div> <div class="content-c"> <div class="advertising-holder"> <div class="title"> <img class="bird" src="images/img-bird.jpg" alt="image description" /> <div class="text"> <h2>2 Awesome Competitions <span>Great Prizes Every Day </span></h2> <strong>Win 5 x Mac iPads AND Daily Experience and Product Vouchers For 30 Days!</strong> <p>Throughout March we are running two <br /> great competitions to celebrate the launch of Snippa.</p> </div> </div> <div class="data"> <img src="images/img-ipad.jpg" alt="image description" class="ipad" /> <h3>MAC IPAD MADNESS!</h3> <p>We have 5 Mac iPads to give away, simple enter by tweeting a link to <br /> this competition and following <a href="http://twitter.com/snippalive" target="_blank">@snippalive</a></p> <h3>Win a Great Experience From Snippa!</h3> <p>We are giving away 2 experience or Product vouchers worth at least £50 <br /> every-day! Simply upload your list of the top 10 things of 2010 and tweet <br /> it out and follow <a href="http://twitter.com/snippalive" target="_blank">@snippalive</a></p> <p class="advice">You can find details of both competitions below, so get tweeting and get posting. Read about yesterdays winners on the competition blog and read the <a href="http://snippa.co.uk/blog/2010/03/08/competition-rules/">rules here</a>. Find out why Snippa saves you £££ on great experiences.</p> </div> </div> </div> <div class="content-b"></div> </div> <div class="content-holder"> <div class="content-t"></div> <div class="content-c"> <div class="firsr-holder"> <h2>MARCH MAC IPAD MADNESS!</h2> <span class="star">1</span> <img src="images/img-ipad2.png" alt="image description" class="ipad" width="352" height="322" /> <div class="two-columns"> <div class="terms-holder"> <h3>5 iPads to be given away, one every 3 days for 15 days!</h3> <strong>To Enter:</strong> <ul> <li>1. Just Tweet this link <?=$entry_url?> to enter the contest.</li> <li>2. Tweet must include "Celebrate the launch of Snippa and win an iPad <?=$entry_url?> "</li> <li>3. Follow @snippalive twitter account </li> </ul> <p>Celebrate the launch of Snippa.co.uk London group buying deals & enter</p> <div class="bubble"> <div class="holder"> <div class="frame"> <p>Celebrate the launch of Snippa and win an iPad <?=$entry_url?> #snippa</p> </div> </div> </div> <div class="btn-holder"> <a href="http://twitter.com/home?status=<?=urlencode('Celebrate the launch of Snippa and win an iPad '.$entry_url.' #snippa')?>" target="_blank">Tweet This</a> <a href="http://twitter.com/snippalive" target="_blank">Follow Us</a> </div> <p class="advice">You can tweet this as many times as you like, <br /> One tweet will be chosen at random every three days to win an iPad.</p> <a href="http://snippa.co.uk/blog/2010/03/08/competition-rules/" class="rules">Rules</a> </div> <div class="win-holder"> <div class="win-box"> <ul> <li><a href="#">coming soon</a><a href="#">....</a><a href="#"></a></li> </ul> <p> </p> <p> </p> </div> <a href="http://snippa.co.uk/blog/category/competition/" class="read">Read More At The Competition Blog</a> </div> </div> </div> </div> <div class="content-b"></div> </div> <div class="content-holder"> <div class="content-t"></div> <div class="content-c"> <div class="second-holder"> <span class="star">2</span> <a name="entryform"></a> <h2>TOP 10 HOT THINGS IN 2010</h2> <h3>10 things you think will be hot in 2010, <br />could be gadgets, people TV, Film, Music, Websites.</h3> <div class="two-columns"> <div class="result-holder"> <div class="prize-holder"> <div class="prize-box"> <strong>Today Prize</strong> <img src="images/img-brand4.gif" alt="image description" /> <p>2X £100 Carluccio's Vouchers</p> </div> <? $ce = competition_entry::last_won(); $ceu = $ce->user(); $items=$ce->entry(); ?> <div class="win-holder"> <strong>Example Winning list <br /> By @snippalive</strong> <div class="list-holder"> <div class="column"> <ul> <? for($i=1 ; $i <= 5 ; $i++ ) { $item=$items[$i-1]; ?><li><?=$i?>. <?=$item?></li> <? } ?> </ul> </div> <div class="column"> <ul> <? for($i=6 ; $i <= 10 ; $i++ ) { $item=$items[$i-1]; ?><li><?=$i?>. <?=$item?></li> <? } ?> </ul> <!-- <a href="#" class="more">More Lists</a> --> </div> </div> </div> </div> <ul class="steps"> <li>1 . Just Enter Your Top 10 In The Boxes Provided On The Right</li> <li>2. Add Your Email & Submit To Enter.</li> <li>3. Tweet or Facebook Update A Link To Your List.</li> <li>4. Follow Us <a href="http://twitter.com/snippalive" target="_blank">@snippalive</a></li> </ul> <div class="brand-place"> <strong>A few of the prize brands:</strong> <ul> <li><img src="images/img-brand1.gif" alt="image description" /></li> <li><img src="images/img-brand2.gif" alt="image description" /></li> <li><img src="images/img-brand3.gif" alt="image description" /></li> <li><img src="images/img-brand4.gif" alt="image description" /></li> </ul> </div> </div> <div class="form-place"> <form method="POST" action="/competition/enter"> <fieldset class="f-subscribe"> <legend class="accesability">Subscribe</legend> <dl> <? for($i = 1 ; $i <= 10 ; $i++) { ?> <dd> <label for="text<?=$i?>"><?=$i?></label> </dd> <dt> <input id="text<?=$i?>" class="text" type="text" name="entry[<?=$i?>]" value="<?=htmlspecialchars($_POST['entry'][$i])?>" /> </dt> <? } ?> <? foreach (array( 'First Name' => 'first_name', 'Surname' => 'last_name', 'Email' => 'email', 'Password' => 'password', ) as $txt => $k) { $err=$errors[$k]; $shtml=$err?"style='color:red;'":''; ?> <dd> <label for="<?=$k?>" <?=$shtml?>><?=$txt?></label> </dd> <dt> <input id="<?=$k?>" class="text" type="text" name="<?=$k?>" value="<?=htmlspecialchars($_POST[$k])?>" /> </dt> <? } ?> <? $err=$errors['terms']; $shtml=$err?"style='color:red;'":''; ?> <dd> <input id="check1" class="check" name="terms" value="yes" type="checkbox" <?=$err?'':'checked'?> /> </dd> <dt> <label for="check1" <?=$shtml?>>I agree to the terms and conditions of the competition and for Snippa.co.uk to email me.</label> </dt> <dd> <a href="http://snippa.co.uk/blog/2010/03/08/competition-rules/" class="rules">Rules</a> </dd> <dt> </dt> </dl> <input type="submit" value="Enter Now" class="btn-enter" /> </fieldset> </form> </div> </div> </div> </div> <div class="content-b"></div> </div> </div> </div> </div> <div id="header"> <div class="header-holder"> <div class="header-frame"> <div class="navbar"> <ul> <!-- <li><a href="#">Change Location</a></li> <li><a href="#">Sign In</a></li> --> <li><a href="http://snippa.co.uk/home/signup/">Sign Up</a></li> </ul> </div> </div> </div> </div> </div> <div id="footer"> <div class="footer-holder"> <div class="columns-holder"> <div class="column"> <strong>Deal Watch</strong> <ul> <li><a href="http://twitter.com/snippalive">Twitter</a></li> <li><a href="http://www.facebook.com/pages/Snippa-London/239023182014">Facebook</a></li> </ul> </div> <div class="column"> <strong>Buying Info</strong> <ul> <li><a href="http://snippa.co.uk/home/howitworks/">How it Works</a></li> <li><a href="http://snippa.co.uk/home/recent/">Recent Deals</a></li> <li><a href="http://snippa.co.uk/home/faq/">FAQ’s</a></li> <li><a href="http://snippa.co.uk/home/terms/">Terms & Privacy</a></li> </ul> </div> <div class="column"> <strong>About Snippa</strong> <ul> <li><a href="http://snippa.co.uk/home/about/">About Us</a></li> <li><a href="http://snippa.co.uk/home/contact/">Contact Us</a></li> <li><a href="http://snippa.co.uk/blog/">Blog</a></li> <li><a href="http://snippa.co.uk/press/room/">Press Room</a></li> </ul> </div> <div class="column"> <strong>Business Owners</strong> <ul> <li><a href="http://snippa.co.uk/home/contactBusiness/">Get Your Business Lists</a></li> <li><a href="http://snippa.co.uk/home/business/">How It Works For Business</a></li> <li><a href="http://snippa.co.uk/home/testimonials/">Testimonials</a></li> </ul> </div> </div> <div class="footer-bottom"> <span>© Snippa Limited 2010</span> </div> </div> </div> </body> </html> Link to comment https://forums.phpfreaks.com/topic/194616-no-thank-you-message-after-submittion/#findComment-1023545 Share on other sites More sharing options...
wmguk Posted March 9, 2010 Author Share Posted March 9, 2010 whats the best way to pop up a small page? with the code I already have Link to comment https://forums.phpfreaks.com/topic/194616-no-thank-you-message-after-submittion/#findComment-1023552 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.