Basically what i want to do is when the user allows an application he will automatically signup for my autoresponder list, so i need to pass the user name and email to the form and automatically submit the form.
Here is the first part when i get the user info:
window.fbAsyncInit = function() {
FB.init({appId: 'xxxxxxxxxxxxxxx', status: true, cookie: true, xfbml: true});
};
FB.Event.subscribe('auth.login', function(response) {
if (response.session) {
FB.api({
method: "fql.query",
query: "SELECT name,email FROM user WHERE uid = " + response.session.uid
}
here is the form:
<form method="post" class="af-form-wrapper" action="http://www.aweber.com/scripts/addlead.pl" >
<div style="display: none;">
<input type="hidden" name="meta_web_form_id" value="XXXXXXXX" />
<input type="hidden" name="meta_split_id" value="" />
<input type="hidden" name="listname" value="XXXXXX" />
<input type="hidden" name="redirect" value="http://www.aweber.com/thankyou.htm?m=default" id="redirect_e96b2b57089ff7b9fbdbc6ac41355eed" />
<input type="hidden" name="meta_adtracking" value="XXXX" />
<input type="hidden" name="meta_message" value="1" />
<input type="hidden" name="meta_required" value="name,email" />
<input type="hidden" name="meta_tooltip" value="" />
</div>
<div id="af-form-XXXXXXXX" class="af-form"><div id="af-header-XXXXXXXX" class="af-header"><div class="bodyText"><p> </p></div></div>
<div id="af-body-XXXXXXXX" class="af-body af-standards">
<div class="af-element">
<label class="previewLabel" for="awf_field-22176678">Name: </label>
<div class="af-textWrap">
<input id="awf_field-22176678" type="text" name="name" class="text" value="" tabindex="500" />
</div>
<div class="af-clear"></div></div>
<div class="af-element">
<label class="previewLabel" for="awf_field-22176679">Email: </label>
<div class="af-textWrap"><input class="text" id="awf_field-22176679" type="text" name="email" value="" tabindex="501" />
</div><div class="af-clear"></div>
</div>
<div class="af-element buttonContainer">
<input name="submit" class="submit" type="submit" value="Submit" tabindex="502" />
<div class="af-clear"></div>
</div>
</div>
</div>
<div style="display: none;"><img src="http://forms.aweber.com/form/displays.htm?id=HGwsjMxsLOwM" alt="" /></div>
</form>
Now i don't really need all the form code because i don't even want it to show (invisible) and all the forms basically have the same inputs names (name="name", name="email")
so i just wanna enter the list name and pass the user's name and his email to the fields and auto submit it using PHP/JavaScript/Jquery.
There is already scripts which does that and i want to build one my self ;)
EDIT: My friend just gave me this code:
customar_formcode=customar_formcode.replace("{email}", user.email);
customar_formcode=customar_formcode.replace("{name}", user.name);
document.getElementById(\'inneraction\').innerHTML=customar_formcode;
document.getElementById(\'form_id\').submit();
he said the user.name and use.email need to be set from the fql first, honestly i don't understand what i need to do next, do i need to insert the code on the page anyway? do i need to post the form in some special javascript format? what does 'inneraction' means?
Thanks!
Instead of applying this type of patch you may use FB registration........
for detailed information on FB registration see below link
http://developers.facebook.com/docs/plugins/registration/
Related
this is a page that displays a list of creatives, and the form offers search functionality to search by job title:
if(isset($_POST['creatives-submit'])){
$job = $_POST['job-title'];
$data = \Db::Common($fms5->DBH)->getWhere("creatives", "creatives_active", "Yes"," AND creatives_job LIKE '%".$job."%'")->orderBy('creatives_name', 'asc');
}
<form method="post" name="creative-search">
<input class="form-control" type="textbox" name="job-title" id="job-title" placeholder="Search by job title" />
<input class="form-control" type="submit" name="creatives-submit" id="creatives-submit" style="display: none;" />
</form>
is there anything that's obviously wrong my my code?
try changing if(isset($_POST['creatives-submit'])) to if(isset($_POST['job-title']) && !empty($_POST["job-title"])) as the form is posting the job-title value and this is the value you actually care about. (Since creatives-submit will always = Submit)
also change
<input class="form-control" type="textbox" name="job-title" id="job-title" placeholder="Search by job title" />
to <input class="form-control" type="text" name="job-title" id="job-title" placeholder="Search by job title" required/>
this means the form can't be submitted unless the job-title field has a value and had the correct type of text
Below is a modification of your code that just returns what the user searched for (Since I don't have it connected to a database)
<?php
if(isset($_POST['job-title']) && !empty($_POST["job-title"])){
$job = $_POST['job-title'];
?>
<p>You Searched For <?php echo $job;?></p>
<?php
}
?>
And the form
<!-- Search Form -->
<form method="post" name="creative-search">
<input class="form-control" required="required" type="text" name="job-title" id="job-title" placeholder="Search by job title" />
<input class="form-control" type="submit" name="creatives-submit" id="creatives-submit" style="display: none;" />
</form>
I want navigate to other div on button click in specific page . How can i do it by header() function or any other function in Php?
<form action="" method="post">
<label for="name">Name:</label>
<input type="text" name="name" value="" />
<label for="email">Email:</label>
<input type="text" name="email" value="" />
<input type="submit" name="submit_request" class="submit_button" value="Sign up" />
</form>
<iframe name="my-iframe" src="about:blank"></iframe>
<div id="text_submit" class="text-success">
<p class="text-center">
THANK YOU FOR SIGNUP WITH US.
YOUR FORM SUBMITTED SUCCESSFULLY!
</p>
</div>
PHP
<?php
if(isset($_POST['submit_request']))
{
$name= $_POST["fn"];
$email= $_POST["ln"];
header("location:my-iframe") // this is a div
}
to redirect to other page you must use header()
here is the syntax:
header('Location: http://www.google.com/');
I have been trying to pre-fill the subject input with information generated in another page, but have been having difficulties with it despite reading a lot of resources about it and seeing examples. I have tried a variety of links, including my most recent attempt with http://www.myurl.com/folder/index.php/contactform?subject=test, but even that doesn't work. Anybody have any advice? Also, if you want to test it out before answering, the page experiencing the problem is the contact page of this website. I've removed information from below to make it more general. Thanks in advance for any and all of the help.
<form id="contactform" method="post">
<input name="recipient" type="hidden" value="myemail" />
<input name="subject" type="hidden" value="Contacter" />
<p id="contactname">
<label>Name:</label>
<input name="name" type="text" />
</p>
<p id="contactemail">
<label>Email:</label>
<input name="email" type="text" />
</p>
<p id="title">
<label>Subject:</label>
<input name="title" type="text" />
</p>
<p id="contactmessage">
<label>Message:</label>
<textarea name="message"></textarea>
</p>
<p id="submit">
<input type="button" value="Send" />
</p>
<input name="redirect" type="hidden" value="myredirectpage" />
</form>
Lets say your page URL is some thing like below
http://www.example.net/index.php?var1=Something&var2=10&var3=ok
You can use $_GET to get the values of var1, var2,and var3 from the above url
In index.php use the below code to fetch url data
echo $_GET['var1'] // Something
echo $_GET['var2'] // 10
echo $_GET['var3'] // ok
Go through this link http://php.net/manual/en/reserved.variables.get.php
With php you can do this with a session.
On the other page(not the form) you can do $_SESSION['subject'] = 'your subject';
On the form page you can acces this cookie ( make sure you have started the session on top of the page with session_start():
<p id="title">
<label>Subject:</label>
<input name="title" type="text" value="<?= $_SESSION['subject'] ?>"/>
</p>
i am working on a login Script. I have a registration and its login, what i need to give a single access/login, i have my fields in database table name is qz_userauth as ID fname lname email username password. Restrict login after one attempt. Possible ?
Here is login Form
<form action="functions.php" method="post" id="login">
<fieldset>
<legend>Login </legend>
<ul>
<li>
<label for="username"><span class="required">Username</span></label>
<input id="username" name="username" class="text required" type="text" />
<label for="username" class="error">This field cannot be empty</label>
</li>
<li>
<label for="password"><span class="required">Password</span></label>
<input name="password" type="password" class="text required" id="password" maxlength="20" />
</li>
<?php if($_SESSION['LCNT']>=4){ ?>
<li>
<p id="p-captcha">
<div id="captchaImg"><img id="captcha" src="captcha/securimage_show.php" alt="CAPTCHA Image" /></div>
<div id="captchaInput"><input type="text" name="captcha_code" size="16" maxlength="6" value="Enter Captcha" /></div>
<div id="captchaRefresh"><img src="captcha/images/refresh.gif" /></div>
</p>
</li>
<?php } ?>
<li>
<label class="centered info"><a id="forgotpassword" href="fpass.php">Forgot Your password...</a></label>
</li>
</ul>
</fieldset>
<input type="hidden" name="action" value="login" />
<fieldset class="submit">
<input type="submit" class="sbutton" value="Login" /> <input type="button" class="sbutton" value="Register" onclick="window.location='register.php'" />
</fieldset>
</form>
Just set one more field in the table as flag. and after one login attempt set the value of flag as false. and check the flag value during login.
If you mean to ask you want to allow only 1 login at a time per user then you can add another field to your table something like login_status. Set this to 1 when user is logged in and 0 on logout. Then in your login script check if this is 0, only then allow login
For some reason my javascript won't execute when my submit button is pressed. It's supposed to leave an error message beside two textfields for a user's name and email address if they are empty, but it's not and I can't figure out why. Normally, when the two boxes are filled, the submit would go to a php page which sends an email. Any suggestions or help with fixing my javascript problem will be greatly appreciated.
This is my javascript:
//my javascript function
<script type='text/javascript'>
function validate_form()
{
$('span.error_message').html('');
var success = true;
$("#validate_form input").each(function()
{
if($(this).val()=="")
{
$(this).next().html("* You must complete this field"); // the error message
success = false;
}
});
return success;
}
</script>
and my form in html:
<form action=".....whatever....." method="POST" id="validate_form" onsubmit="return validate_form();">
<ol>
<li>
<span id="question">___ is your name? My name is Marie.</span>
<input type="text" name="q1" id="q1" />
</li>
<li>
<span id="question">___ are you from? I'm from Paris, France.</span>
<input type="text" name="q2" id="q2" />
</li>
<li>
<span id="question">Dave: ___ you like football</span>
<p>
<input type="radio" name="q6" value="1" id="q6_1" />
<label for="q6_1">Are</label>
<input type="radio" name="q6" value="2" id="q6_2" />
<label for="q6_2">Do</label>
<input type="radio" name="q6" value="3" id="q6_3" />
<label for="q6_3">Does</label>
<input type="radio" name="q6" value="4" id="q6_4" />
<label for="q6_4">Is</label>
</p>
</li>
<div id="username">
<p>
Before we begin, please enter your name and email:
<br />
<label for="user_name">Name: </label><input type="text" name="user_name" id="user_name" />
<span class="error_message" style="color:#FF0000"></span>
<br />
<label for="user_email">Email: </label><input type="text" name="user_email" id="user_email" />
<span class="error_message" style="color:#FF0000"></span>
</p>
</div>
<p style="width: 242px; margin: auto;">
<input type="submit" name="submit" value="Submit your answers" id="but" />
</p>
</form>
Edit: Fixed the problem with the javascript being called, but now the submit button isn't working even with the two textfields being filled.
$("#validate_form input") - I don't see validate_form anywhere; you need to add it or just use: $("input")
Firebug for firefox would help you debug these types of jscript issues. You can also use the Error Console in Firefox if you dont want to install firebug.