I want to have a search box where a person types in a number and the form opens a new page where there is an iframe and the url of the iframe is http://othersite.com/results.php?id=numbersinputfromsearchbox
Is this possible? I am using wordpress with php/mysql/apache/linux if that helps you to answer me. Thanks!!
<form action="http://othersite.com/results.php?id=numbersblahblah" method="post" target="_blank">
<!-- form fields here -->
<input type="submit" value="Search" />
</form>
Related
I have a button in my html form that I want it to take user to food.php when they click on it, I did this but it's not redirecting, Please help
<a href="food.php">
<button name="submit" type="button" id="food">Food - Equipment</button>
</a>
Try this:
<button>Food - Equipment</button>
Why use a button element inside a link tag? Why not just:
Food - Equipment
Try that and see if it fixes it.
A button is requested, not a link. Sometimes linked php files don't work as expected in some browsers. Use a form submit button and you'll get what you're looking for.
<form action="food.php" method="GET"> <!-- use get or post if you want
to send anything -->
<input type="submit" value="GO">
</form>
I have been working on displaying a url, submitted from a form, in an iframe on the same page. I had everything working fine, except the page would refresh to the top. So I used target="iframe" to stop this from occuring. Now I cannot get new url's to show to the iframe, but when I refresh my page, an old url that was submitted keeps showing up. How to I get the content of the iframe to accept the a newly submitted URL? The lociation of the form and iframe is http://www.4mobilesites.com and the code that I am using is:
<div class="mobile-logo">
<H2>How does your website look on a Mobile Device?</h2>
<?php
$keyurl = $_POST['siteurl'];
?>
<form method="post" target="frame">
Enter your website's URL: <input type="text" name="siteurl" value="http://" size="50"><br>
<input type="submit" value="VIEW">
</form><br>
<a name="iframe-1"></a>
<div class="theiframewrap"><iframe name="frame" class="theiframeid" src="<?php echo "$keyurl"; ?>" id="frame"></iframe></div>
</div>
Here's what I'm looking to accomplish. When a user creates a profile they fill out some information with a form. After they submit the form the information is displayed on their profile. One of the form fields is going to be a button that other users can click to do an action. To display the button this is the PHP I currently have:
add_action('kleo_bp_after_profile_name', 'my_profile_button');
function my_profile_button()
{
echo 'Talk';
}
I need to input the form information into the href="#" spot. Does anyone know a way around this?
Thanks.
It sounds like you want to simply submit a form that a user fills out. If that is the case, you can't use a link, but you need to use a button:
<form action="submitpage.php" method="post">
Name: <input type="text" />
<input type="submit" value="Some Text" />
</form>
or
<form action="submitpage.php" method="post">
Name: <input type="text" />
<button type="submit" class="success button radius show-for-small">Some Text</button>
</form>
Sure, if you have captured that information with a POST variable, named 'redirect' for example, you could use it to generate a button. The problem is that I don't understand very well what you mean with be put into href="#" spot, because buttons don't have that property, so I write you the code to use it on a redirection which is done at clicking the button:
<input type="button" value="submit" onclick="location.href='<?php echo $_POST["redirect"];?>';">
If you want to use information in a link, which actually have href property use this:
<a id="link" href="<?php echo $_POST['redirect'];?>">Text of the link</a>
I have created one form to upload images for custom use
<form id="file-upload" action="" method="POST" enctype="multipart/form-data">
<div id="image-uploader-box" class="group">
<div id="forms" class="add-photo-fields">
<input type="submit" value="Upload" />
<input type="button" id="add-photo-button" class="add-photo-button" value="Add Photo"/>
</div>
</div>
</form>
Now it is working fine with uploading image and storing to proper place. But what I exactly want is auto submit above form when user submit WordPress comment. ( when user hit the submit comment button )
Can anyone help me for this? I am fine with jquery or php either way.
This is the place to go: http://api.jquery.com/submit/ (jquery's submit function)
When uploading files you can post to an iframe: How do you post to an iframe?
I'm a noobie programmer and I wonder how to properly submit a form with javascript.
I made some test code to show you what I mean:
<?php
if (isset($_POST['message']))
{
echo $_POST['message'];
}
?>
<script>
function formsubmit()
{
document.getElementById('form').submit();
}
</script>
<form id="form" name="form" action="" method="post">
<input id="message" name="message" value="hello world">
<input id="submit" name="submit" type="submit">
</form>
Click me<br/>
<input type="submit" onClick="formsubmit()" value="Click me">
When you push the "submit" button inside the tags - the php code will echo "hello world".
When submitting the form with JS the values won't post to the page. What am I doing wrong?
Thanks in advance.
I've searched the whole afternoon for a solution, but cause of my lack of knowledge about programming I failed to find it.
Believe it or not, but the main problem lies here:
<input id="submit" name="submit" type="submit">
If a form contains an input element with name (or id) of submit it will mask the .submit() method of the form element, because .submit will point to the button instead of the method. Just change it to this:
<input name="go" type="submit">
See also: Notes for form.submit()
The smaller problem is here:
Click me<br/>
An empty anchor will just request the same page again before calling formsubmit(). Just add href="#".
The problem here is that the id and name of the input element on your form is called submit.
This will mask the submit function for the form. Change the name and id and you will be able to use javascript to submit the form.
try setting the href of the to '#'. I would guess what is happening is that by clicking on the link, it submits the form and immediately changes the url to the same page you are on cancelling the form submit before it has a chance to go.