bigbag Posted July 7, 2012 Share Posted July 7, 2012 I have to insert 2 PHP tags on a single page: <?php $fname = $_POST['fname']; $lname = $_POST['lname']; $email = $_POST['email']; $address = $_POST['address']; $city = $_POST['city']; $state = $_POST['state']; $zipcode = $_POST['zipcode']; $phone1 = $_POST['phone1']; $phone2 = $_POST['phone2']; $phone3 = $_POST['phone3']; if( !filter_var($email, FILTER_VALIDATE_EMAIL) || empty($email) ) { // Invalid Email header("Location: http://domain.com"); } $location = "http://www.domain.com?fname=$fname&lname=$lname&pp1=$phone1&pp2=$phone2&pp3=$phone3&email=$email&straddr=$address&city=$city&state=$state&zip=$zipcode"; ?> And <?php require_once('geoipcity.inc'); $gi = geoip_open('GeoLiteCity.dat', GEOIP_STANDARD); $location = GeoIP_record_by_addr($gi, $_SERVER['REMOTE_ADDR']); geoip_close($gi); ?> However, when I combine the two (one on top of the other right above <html>) and it doesn't work when I try to query the GeoIP tag using the following: <?php echo $location->region_name ?> There seems to be some sort of conflict with the two because I get a blank page (functions normally if I take out the GeoIP code). Is there a way to combine them on a page? Thanks Quote Link to comment https://forums.phpfreaks.com/topic/265362-how-to-combine-2-php-tags/ Share on other sites More sharing options...
bigbag Posted July 7, 2012 Author Share Posted July 7, 2012 I did further troubleshooting and I found out that the following PHP tag in this line was making my entire page blank: <input type="button" class="creditbtn" id="popup_submit_form" onclick="window.location.href='<?php echo $location; ?>';" /> Is there a way to fix this? Quote Link to comment https://forums.phpfreaks.com/topic/265362-how-to-combine-2-php-tags/#findComment-1359936 Share on other sites More sharing options...
xyph Posted July 7, 2012 Share Posted July 7, 2012 You probably want error reporting turned on, check out the bottom of my signature. Quote Link to comment https://forums.phpfreaks.com/topic/265362-how-to-combine-2-php-tags/#findComment-1359944 Share on other sites More sharing options...
hakimserwa Posted July 8, 2012 Share Posted July 8, 2012 change your $location to this $location = "http://www.domain.com?fname=".$fname."&lname=".$lname."pp1=".$phone1."&pp2=."$phone2."&pp3=".$phone3."&email=".$email."&straddr=".$address."&city=".$city."&state=".$state."&zip=".$zipcode"; Quote Link to comment https://forums.phpfreaks.com/topic/265362-how-to-combine-2-php-tags/#findComment-1360004 Share on other sites More sharing options...
jcbones Posted July 8, 2012 Share Posted July 8, 2012 change your $location to this $location = "http://www.domain.com?fname=".$fname."&lname=".$lname."pp1=".$phone1."&pp2=."$phone2."&pp3=".$phone3."&email=".$email."&straddr=".$address."&city=".$city."&state=".$state."&zip=".$zipcode"; That is no different than what he has currently. To the OP, you are overwriting your $location variable. Change the variable name that holds your GeoIP info, and echo the region using that variable. Then the button element should work. Don't forget to follow Xyph's advice, and turn on error_reporting and display_errors. Quote Link to comment https://forums.phpfreaks.com/topic/265362-how-to-combine-2-php-tags/#findComment-1360007 Share on other sites More sharing options...
hakimserwa Posted July 8, 2012 Share Posted July 8, 2012 change your $location to this $location = "http://www.domain.com?fname=".$fname."&lname=".$lname."pp1=".$phone1."&pp2=."$phone2."&pp3=".$phone3."&email=".$email."&straddr=".$address."&city=".$city."&state=".$state."&zip=".$zipcode"; That is no different than what he has currently. To the OP, you are overwriting your $location variable. Change the variable name that holds your GeoIP info, and echo the region using that variable. Then the button element should work. Don't forget to follow Xyph's advice, and turn on error_reporting and display_errors. No sir correct me if am wrong valuable were not echoed out in his string rather they were just sitted there Quote Link to comment https://forums.phpfreaks.com/topic/265362-how-to-combine-2-php-tags/#findComment-1360058 Share on other sites More sharing options...
Pikachu2000 Posted July 8, 2012 Share Posted July 8, 2012 change your $location to this $location = "http://www.domain.com?fname=".$fname."&lname=".$lname."pp1=".$phone1."&pp2=."$phone2."&pp3=".$phone3."&email=".$email."&straddr=".$address."&city=".$city."&state=".$state."&zip=".$zipcode"; That is no different than what he has currently. To the OP, you are overwriting your $location variable. Change the variable name that holds your GeoIP info, and echo the region using that variable. Then the button element should work. Don't forget to follow Xyph's advice, and turn on error_reporting and display_errors. No sir correct me if am wrong valuable were not echoed out in his string rather they were just sitted there The 2 are functionally identical, and both are simply being assigned to a variable. Adding quotes and concatenating variables doesn't cause them to be echoed. Quote Link to comment https://forums.phpfreaks.com/topic/265362-how-to-combine-2-php-tags/#findComment-1360062 Share on other sites More sharing options...
hakimserwa Posted July 8, 2012 Share Posted July 8, 2012 will try to play around with it to prove it more anyway thanks for the info Quote Link to comment https://forums.phpfreaks.com/topic/265362-how-to-combine-2-php-tags/#findComment-1360066 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.