Hello i want to make one form That Submits data to XXXXXXX and opens a new tab alongside with mydomain.com
Please Help Me To Get This..
<form action="XXXXXXXXXX" method="get" style="margin-top: 12px;">
<label>
<input type="text" name="user" value="" style="width: 100%" placeholder="Your Code Here" autocomplete="off" autofocus="" required>
</label>
<input type="submit" style="width: 84px;margin-top: 10px;" value="Submit" class="submit">
</form>
Please Send me Some Details To Do This.. i Firstly Saw This on official-liker.net submit button..
Try this
<form action="XXXXXXXXXX" method="get" style="margin-top: 12px;" target=_blank>
<label>
<input type="text" name="user" value="" style="width: 100%" placeholder="Your Code
Here" autocomplete="off" autofocus="" required>
</label>
<input type="submit" style="width: 84px;margin-top: 10px;" value="Submit"
class="submit">
</form>
The target attribute specifies a name or a keyword that indicates where to display the response that is received after submitting the form.
For that you would need to use jQuery to submit the form using AJAX and in it's success callback via
window.open(url,'_blank');
Try something like below
<form action="XXXXXXXXXX.php" method="get" target="_blank" style="margin-top: 12px;">
If you want to get Redirected after the Post header("Location: http://www.example.com/") php function.
If you want to open alongside you can use JQuery.
<form>
<input name="text2" type="text" id="text" />
<a class="className" href="#" name="save" id="saveButton">Save</A>
</form>
After that some JavaScript stuff:
$(document).ready(function() {
$("#save").click(function(e) {
e.preventDefault();
$.post("sendPhp.php", { textPost : $("#text").val()},
function(html) {
//open a new window here
window.open("mydomain.com");
}
});
});
No need for Javascript, you just have to add a target="_blank" attribute in your form tag.
<form action="XXXXXXXXXX" method="get" style="margin-top: 12px;" target=_blank>
<label>
<input type="text" name="user" value="" style="width: 100%" placeholder="Your Code Here" autocomplete="off" autofocus="" required>
</label>
<input type="submit" style="width: 84px;margin-top: 10px;" value="Submit" class="submit">
</form>
Following link will help:HTML form target
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 to get value of input of my form via $_post in my insert page but my problem is that i get error massage:undefined index:track_code and i cant get value of it.the names is same what is problem?
this is my problem why stackoverflow want more detail. this is all detail
<form action="insert.php" method="post">
<input name="track_code" type="text" class="tiny-size" value="<?php echo $track_code_rnd ; ?>" style="width: auto;height: auto" disabled />
</form>
<form action="insert.php" method="post" class="form-horizontal form-checkout">
<div class="control-group">
<label class="control-label" for="firstName">نام<span class="red-clr bold">*</span></label>
<div class="controls">
<input name="first_name" type="text" id="firstName" class="span4" >
</div>
</div>
<div class="control-group">
<label class="control-label" for="lastName">نام خانوادگی<span class="red-clr bold">*</span></label>
<div class="controls">
<input name="last_name" type="text" id="lastName" class="span4">
</div>
</div>
<input name="submit" type="submit" class="btn btn-success" value="خرید" style="width: 66px"/>
</form>
<form action="insert.php" method="post">
<input name="track_code" type="text" class="tiny-size" value="<?php echo $track_code_rnd ; ?>" style="width: auto;height: auto" disabled />
</form>
<?php
$track_code = $_POST['track_code'];
?>
Set this one code in your form
<form action="insert.php" method="post">
<input name="track_code" type="text" class="tiny-size" value="<?php echo ($track_code_rnd)?$track_code_rnd:'';?>" style="width: auto;height: auto" disabled />
</form>
Remove disable tag from your input code. Disable controls wont be posted on server. for that you can make it readonly or make it hide
Try Putting the PHP code on the form. as given below.
<?php
if (isset($_POST['submit'])) {
$track_code = $_POST['track_code'];
}
?>
<form action="your_page.php" method="post">
<input name="track_code" type="text" class="tiny-size" value="<?php echo $track_code_rnd; ?>" style="width: auto;height: auto" readonly />
<input name="submit" type="submit" />
</form>
It will execute the whole file as PHP. The first time you open it, $_POST['submit'] won't be set because the form has not been sent. Once you click on the submit button, it will print the information.
Disabled controls never post on server. So make it readonly or hidden.
I want use my own button in form
When i'm using
<form method="post" action="check_login.php">
<input class="textbox" name="username" type="text" placeholder="Login">
<input class="textbox" name="password" type="password" placeholder="Password">
<div id="buttonPlace">
<p>Remember Me</p>
<input type="submit" value="Log in!" />
</form>
it works great. I would like to use my own button. When Im using this code :
<form method="post" action="check_login.php">
<input class="textbox" name="username" type="text" placeholder="Login">
<input class="textbox" name="password" type="password" placeholder="Password">
<div id="buttonPlace">
<p>Remember Me</p>
<div id="buttonLogin" type="submit">sing up</div>
</form>
Button doesn't work.
Why?
<form method="post" action="check_login.php">
<input class="textbox" name="username" type="text" placeholder="Login">
<input class="textbox" name="password" type="password" placeholder="Password">
<div id="buttonPlace">
<p>Remember Me</p>
<button id="buttonLogin" type="submit">Sign up</button>
</div>
</form>
Div can't have type="submit" property, only form inputs can have different input types property. If you want to style your submit button, use:
<input class="submitbutton" type="submit">Sign up</input>
and then define css style for your button class:
.submitButton {
.width: 60px;
.height: 20px;
.color: #dd5599;
}
If you want to submit form on click of your div, use need to assing its click a function to sumbit the form :-
$( document ).ready(function() {
$( "#buttonLogin" ).click(function() {
$( this ).closest("form").submit();
});
}
However, it is better to use button or input for submission.
I have got two different forms on the same page.
<form action="" method="post" onsubmit="ajax_send('<?print $userid;?>',this.msg.value); return false;">
<input id="msg" autocomplete="off" type="text" name="msg" stlye="width: 80px;" autofocus="autofocus" placeholder="Chat here" />
<input type="submit" />
</form>
and
<form action="?page=about&id=0#comments" method="post">
<textarea class="editbox" id="exitbox" placeholder="Write a comment ..." name="newcomment"></textarea>
<input type="submit" id="submit1" name="submit1"></div></div>
Now when I enter something in <input id="msg"..> and press enter, it submits the second form instead of the first one.
What am I missing?
Your second form isn't closed.
Your second form should by like that
<form action="?page=about&id=0#comments" method="post">
<textarea class="editbox" id="exitbox" placeholder="Write a comment ..." name="newcomment"></textarea>
<input type="submit" id="submit1" name="submit1"></div></div>
</form>
I have a problem with the html form.
This is my code:
<form name="contactform" method="post" action="send_form_email.php">
<input id="first_name" type="text" name="first_name" size="30"/>
<input id="company_name" type="text" name="company_name" size="30"/>
<input id="email" type="text" name="email" size="30"/>
<input type="image" align="middle" src="images/accept.png" alt="Submit" /> <input id="reset" type="image" src="images/reset.png" alt="Reset" align="middle" />
</form>
when I click any of this images my form is sent. How can I make this reset picture to only reset and not to send the form.
Your reset button is not a reset button. It has type="image", it is server side image map.
When you click on a server side image map the form will be submitted and the coordinates you clicked on will be included in the data.
If you want a reset button that is an image use:
<button type="reset"><img src="..." alt="..."></button>
The image type is like a submit button.
You have to take type="reset" and style your button with css.
Use
<input type = "reset" value = "" class = "btnResetClass" />
Your, btnResetClass will have Css Setting for background image to be set by you.
You have to use type="reset".
This jsFiddle example would be better.
HTML:
<form id="contactform" method="post" action="send_form_email.php">
<div>
<label>
First Name: <input id="first_name" name="first_name" type="text" size="30" />
</label>
</div>
<div>
<label>
Company Name: <input id="company_name" name="company_name" type="text" size="30" />
</label>
</div>
<div>
<label>
Email: <input id="email" type="text" name="email" size="30" />
</label>
</div>
<input id="submit" type="submit" value="" title="Submit" />
<input id="reset" type="reset" value="" title="Reset" />
</form>
CSS:
#submit, #reset {
border: none;
width: 64px;
height: 48px
}
#submit {
background: url('images/submit.png')
}
#reset {
background: url('images/reset.png')
}