Adding links to a custom form - php

Basically what i wanted to achieve here is adding a "?" to the form url.
My current code that is not working:
<form action="'.$config['base_url'].'/whatever/users.php?f=verification">
<button class="btn btn-success">Verification</button>
</form>
i would love for someone to explain what i did wrong so i can learn from my mistake and also possibly solve the issue to retain a good answer along with me learning to see what i did wrong here.
As far as my testing goes everything else seams to be working, what is happening here is that i get redirected to "/whatever/users.php" instead of "/whatever/users.php?f=verification"

echo the base_url into the form action and add the f parameter and value to the button element. On submit f=verification will be in the POST/GET.
<form action="<?=$config['base_url']?>/whatever/users.php">
<button class="btn btn-success" type="submit" name="f" value="verification" >Verification</button>
</form>

Related

How to get the "GET" url from a website with a SUBMIT button?

I have this site https://teleservices. paris .fr/fourrieres/ (remove the blank in the URL) and I would like to recreate the form submit using a GET url method.
I looked at the source code :
<button type="submit" class="button" name="action_rechercher">
CONTINUER <img class="arrow-bottom" src="images/arrow-bottom.png">
</button>
but I don't understand the code. I would like to be able to use a URL like, so I can call the result directly from a link like this one
https://teleservices. paris .fr/fourrieres/action?immatriculation=TY32EYU
Hope you understand,
Thanks for your help
<form name="yourFormName" method="GET" action="someFile">
<!-- Do something -->
</form>

I have an html button I'm trying to redirect to a PHP file in XAMPP

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>

Recieving "GET" instead of "POST"

I'm doing a project and using PHP. There is signup.php page with form and it is sending "GET" instead of "POST". Even after hours of debugging, I could not come up with anything, I found a similar question but that seems to be of no help in my case. I have similar login.php page with almost same code and that works fine, I don't know what wrong I'm doing.
<form name="signUpForm" id="signUpForm" action="signup.php" method="post">
//form elements
<button type="submit" value="Submit">Submit</button>
</form>
Following the question mentioned, I tried to change it to
<button type="submit" value="Submit" formmethod="POST" formaction="signup.php" >Submit</button>
But this also gives the same result.
echo $_SERVER["REQUEST_METHOD"];
Above statement prints "GET" in PHP.
I would like to know what I'm missing, I know similar questions exist but I checked them before putting the question.
GET is the automatic default. Make sure that you close all of your open form tags and set the method="POST".
I just ran into this problem!

Search bar disfunctional

I have made a small HTML search bar that is supposed to be capable of going to any page within the website. The only problem is, it won't leave that page, and if it does, it says the file is not found. Here is the code I have associated with it so far:
<form method="post" action="" name="search">
<input name="search" >
<button type="submit" name="Submit" onclick="window.location='http://localhost:8080/filefolder/<?php echo "'".$_POST[search]."'" ?>'">
Submit</button>
</form>
When you type anything into the search bar, and you click submit, the page just reloads and empties the search bar which is really frustrating.
So this is all that I have associated with the current search bar. What exactly am I doing wrong with it? I even added JavaScript telling the search button to send it to the page typed out. Can someone help me with this? Thank you.
Your code includes extra quotes which I don't believe you intended to have.
For example:
http://localhost:8080/filefolder/<?php echo "'".$_POST[search]."'" ?>'">
Is resulting in:
http://localhost:8080/filefolder/'search''">
As you can see this will break the javascript syntax when it tries to read that string.
Rewrite it as:
http://localhost:8080/filefolder/<?php echo $_POST['search'] ?>'">
Also add a return false to the end.
<button onclick="window.location.href='value_for_url'; return false;" />

Form submit not working with twitter bootstrap (PHP $_POST)

I just started using twitter bootstrap, and I got stuck trying to get my form submit button to submit (PHP $_POST). Does anyone know why its not working?
No clue really..
I've been doing this previously and its been working until bootstrap:
<?php
if (isset($_POST["login"]) && $_POST["login"]=="login") {
echo "login here";
}
?>
<form action="http://mysite.com" method="post">
<input type="hidden" id="login" name="login" value="login" />
<button class="btn success" type="submit">Login</button>
</form>
The page seems to load but the PHP does not. Is the POST information being blocked?
My form input elements did not have an id or name (I didn't include them in my example).
Not an HTML expert, but I've always used <input type="submit" /> and not <button type="submit" />, not sure that button is a functional form element.
Also, your button element is closed twice - first with /> in the opening tag, and then again with a closing tag for no reason.
Maybe you are wrong with the action="http://mysite.com"? That attribute is for specifing the form data receiver, so in your case I think it's the page itself. So, if your page is named mypage.php, use action="mypage.php".
I had this same issue as well, turns out I was missing the name="submit". Gotta have that so the $_POST has a key in the assoc array!
it is adviseable that every element has a name thus (name="elementName") this makes it easy to reference them in your php scipt; also ensure that a form action and method are set.

Categories