wzshop
Members-
Posts
16 -
Joined
-
Last visited
Profile Information
-
Gender
Not Telling
wzshop's Achievements
Newbie (1/5)
0
Reputation
-
Hi guys, I was wondering if it is possible to like a page on facebook through a checkbox, instead of using the FB like function/script. In other words; people fill out a form and can check the box if they like the page, such as: <?php if (isset($_POST['form'])) { if (isset($_POST['facebook_checkbox'])) { //like page } else{ //don't like } } ?> <form action="<? $_SERVER['PHP_SELF'];?>" method="post"> <input type="checkbox" id="facebook_checkbox" name="facebook_checkbox" /> <input type="submit" name="form" /> Is there any possibility to do that? Thanks in advance.
-
It is actually part of a quite large order form. Nevertheless I really appreciated your assistance! Thanks again for all yr time! Robbert
-
well actually since i have a very "large" form and i wanted to know if i really needed to edit all code that was already present.. I do understand your solution now though..
-
ok thanks, thus if i implement my own custom form validation, it is all good?
-
Sorry to bother you once more, I am trying to understand the code.. Why did you not use the if(isset($_POST['btn'])) function? Is that some outdated code or? Anyway, while i was trying to understand the code, I deleted some code to see what exact function it fulfills. I found that the code below, actually does what it should.. thus i was therefore wondering if you could please further explain your given solution.. See the script live here: http://www.maakmijnportret.nl/test3.php <?php session_start(); if (isset($_POST['position']) && !empty($_POST['position'])) { $_SESSION['position'] = $_POST['position']; } if (isset($_POST['name']) && !empty($_POST['name'])) { $_SESSION['name'] = $_POST['name']; } if (isset($_POST['newsletter']) && !empty($_POST['newsletter'])) { $_SESSION['newsletter'] = $_POST['newsletter']; } $name = $_SESSION['name']; $position = $_SESSION['position']; $newsletter = $_SESSION['newsletter']; if(!isset($_POST['btn']) && !isset($_POST['overview'])) { ?> <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post" enctype="multipart/form-data"> <input type="text" value="<?php echo $position; ?>" name="position" /> <input type="checkbox" class="styled" name="newsletter" value="on" <?php if($newsletter == 'on') { echo "checked";} ?> /> <input type="submit" name="btn" /> </form> <?php session_destroy(); } if(isset($_POST['btn'])) { ?> <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post" enctype="multipart/form-data"> <input type="text" value="" name="name" /> <input type="submit" name="overview" /> </form> Go <a href="<?php echo $_SERVER['PHP_SELF']; ?>?backto=position">back</a> <?php } if(isset($_POST['overview'])){ echo $position; echo $name; if($newsletter == 'on') { echo "Newletter on!"; } echo 'Go <a href="'. $_SERVER['PHP_SELF'].'">back</a>'; } ?> Thanks again, Robbert
-
Works great! except the "reset" function at the end gives an error: Warning: session_destroy() [function.session-destroy]: Trying to destroy uninitialized session in /home/musicv/public_html/maakmijnportret.nl/test3.php on line 49 is that just a warning or a bug? Thanks, learn a lot;)
-
done, one question though; is it also possible to go back in the session. Thus let's say you're here if(!empty($position) && empty($name)) and you want 1 step back in the form, for instance to uncheck the box, is that possible to implement or? Thanks again, Robbert
-
Thank you sooo much! works like a charm. I will follow up your advice Grts, Robbert
-
Sorry, one more question. Is there any way to (dubble) check if the checkbox is checked or not, everytime the form submits? For instance, if i check the checkbox, submit the form, go back and uncheck the checkbox.. it will stay checked in the session. Try my script at: http://www.maakmijnportret.nl/test3.php <?php session_start(); // start up your PHP session! if (isset($_POST['position'])) { $_SESSION['position']=$_POST['position']; } if (isset($_POST['name'])) { $_SESSION['name']=$_POST['name']; } if (isset($_POST['newsletter'])) { $_SESSION['newsletter']=$_POST['newsletter']; } $name = $_SESSION['name']; $position = $_SESSION['position']; $newsletter = $_SESSION['newsletter']; // eerste formulier if(!isset($_POST['overview']) && !isset($_POST['btn'])) { ?> <form action="<? $_SERVER['PHP_SELF'];?>" method="post" enctype="multipart/form-data"> <input type="text" value="" name="position" /> <input type="checkbox" class="styled" name="newsletter" value="on" <? if($newsletter == 'on') { echo "checked";} ?> /> <input type="submit" name="btn" /> </form> <?php } // form 2 if(isset($_POST['btn'])) { ?><form action="<? $_SERVER['PHP_SELF'];?>" method="post" enctype="multipart/form-data"> <input type="text" value="" name="name" /> <input type="submit" name="overview" /> </form> <?php } if(isset($_POST['overview'])) { echo $position; echo $name; if($newsletter == 'on') { echo "testing"; } } ?> Once the checkbox is checked, "testing" will keep showing up. Thanks again!
-
you seem to be right Thanks a lot!
-
The code you gave is similar to mine. But i have another statement: <?php session_start(); if (isset($_POST['newsletter'])) { $_SESSION['newsletter'] = $_POST['newsletter']; $newsletter = $_SESSION['newsletter']; } if($newsletter == "yes") { $newsl = 1; } //later in the code i use an if statement if($newsl == "1"){ echo"example"; } ?> When i put $newsletter = $_SESSION['newsletter']; outside the }, the word "example" will be echoot no matter if i checked the checkbox or not.
-
hmm although the problem is now that he does not save $newsletter to be used in a later stadium of the contactform right? When i trie to echo $newsl nothing comes up.. Is it possible to bypass that? Thanks again.
-
hmm thanks a lot, i placed $newsletter = $_SESSION['newsletter']; outside the } . When i place it inside the } it works! Thanks again:)
-
i am very sorry.. Forgot that too, have it in my original code... I actually expected that the code i "improvised" was not good at all, but that is not the case?
-
Hi there, Sorry forgot that in the code above, have it in my original code though.. Thanks for your reply! Robbert