I have a HTML form where after the user submits the form they see my FormSubmit.php thank you page. Is there a way to make that thank you page still display after submission, but also add a link to another php page that shows you a list of who added their names?
I created a SignupList.php page that reads from a text file. I added the link to the form HTML page at the bottom and to the FormSubmit.php thank you page, but when I add a name ,reach my FormSubmit.php thank you page, then click the link to my SignupList.php page there are no names on it. I noticed on the HTML page in the form action section when I replace FormSubmit.php with SignupList.php I get my desired results a name displays after hitting submit, but my thank you page is gone since I removed the action to it. Any suggestions on how I can do both? Please let me know if I need to explain further.
<!DOCType html>
<html>
<head>
<title>Form</title>
<html lang="en">
<link rel="stylesheet" type="text/css" href="css/stylesheet.css">
</head>
<body>
<form method="post" action="FormSubmit.php">
<p>Please sign up</p>
<p> First Name:<br>
<input type="text" name="firstname" size="30">
</p>
<p> Last Name:<br>
<input type="text" name= "last name" size="30">
</p>
<p>
<input type="submit" value="Submit Information">
</p>
View Sign Ups
</form>
</body>
</html>
edit: I am not sure why i was down voted, but i figured out the issue. I needed to edit my FormSubmit.php file to write to the document.
In your Formsubmit.php, add:
header('Refresh: 3;url=page.php');
which will refresh the header and redirect the page after 3 seconds.
Related
I simplified my real php page just to get an idea, I have this simple php page with a div, I want to keep this div open and its input with the text that has been changed by the user, when I change the page and go to page2.php
<html>
<head> stuff.. </head>
<body>
stuff in the body..
<div>I want this div to stay in the other page, (without cloning it)
<input type="text" value="hello" />
</div>
</body>
</html>
I have a database with some numbers assigned to a fake account (PHP).
I try to contact the database (with success) and get the right result from the form.
My issue is that the form result open a new page and display there...
I would really like the result to be displayed IN the module I use to send the form OR anywhere else on the same page I used to send the form.
<!DOCTYPE html>
<html>
<body>
<form
method="post"
action="http://ggdbase.dx.am/impulseGetInfo.php"
target="_self">
Account name:<br>
<input type="text" name="name" value="derps">
<br>
<input type="submit" value="Click To Load Account Info">
</form>
</body>
</html>
This is what the module look like (on Enjin.com)
This is what I get when clicking the button
I did try replacing '_self' with '_blank' or parent and all the other options I could find but none of them gave me a different result :S
Could it be caused by the Enjin system itself ?
Do not use target. And replace the action as
action=""
This will ensure that you are calling the same page. Write the PHP code there itself.
Hope that help!
so I'm currently following this tutorial on PHP forms and ive made it to the bottom of this page where it says to test the form so far, http://www.webreference.com/programming/php/search/2.html
"Save your file and test your form at this point (search_display.php)."
When I go to type in a users name in thew design view of dreamweaver and hit submit nothing happens (as if the page is refreshing) however, when i navigate to my file from my MySQL (XAMP and phpMyADmin) server directory i can view my search page but there is no text box/area for me to enter in any data. I have followed/copied this tutorial verbatim and im quite unsure on why I can not get my data to submit to the query. Here is the code for my search page
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Search Contacts</title>
</head>
<p>
<body>
<h3>Search Contacts Details</h3>
<p>You may search either by first or last name</p>
<form method="post" action="search.php?go" id="searchform">
<p>
<input type="submit" name="submit" value="Search">
</p>
</form>
</body>
</p>
</html>
Thanks guys for the help.
Your HTML form is missing a text field. Please check the HTML sample on the first tutorial page.
Side note: you really should not be following this tutorial as it is greatly outdated, teaches bad practices and will not work when using PHP 7+ due to the removed mysql extension.
1. Place this code where you need the form. For example index.php . There is no input field in your form. So add input fields. For example i am adding email and mobile no as input fields
<h3>Search Contacts Details</h3>
<p>You may search either by first or last name</p>
<form method="post" action="search.php" id="searchform">
<input type="text" name="email" value="">
<input type="text" name="mobileno" value="">
<input type="submit" name="submit" value="Search">
</form>
2. Create another page called search.php and place the below code here
if(isset($_POST['submit'])){
$email = $_POST['email'];
$mobileno = $_POST['mobileno'];
}
Validate all the fields before inserting into database.
I've made simple form for example in file.php:
<!DOCTYPE html>
<html>
<head>
<title></title>
</head>
<body>
<form method="get">
<input type="hidden" name="var" value="example"/>
<input type="submit" value="Submit"/>
</form>
Link
</body>
<html>
Ok. Now when i'm going directly to localhost/file.php then click submit and it goes to localhost/file.php?var=example. Then next i click the Link it goes to localhost/file.php?var=example# so its working.
But I'm building component for joomla. I go to my component by alias -> localhost/joomla/index.php/users_hosts_list, Now i'm on default view and default layout, then i put the form, that is the example file.php shown above.
When i submit the form it goes to localhost/joomla/index.php/users_hosts_list?var=example and i meet the problem. When i click the link, instead of go to localhost/joomla/index.php/users_hosts_list?var=example#, this Link delete variable var and it goes to localhost/joomla/index.php/users_hosts_list#.
What should i change to fix that?
I followed your steps but Joomla form is getting me to home page with ?var=example#.
Can you write something like this
<?php
$post = JRequest::get('post');
$link = "index.php?option=com_advsearch&view=advsearch&layout=test"; // your Joomla link
if($post['var'])
$newlink = "index.php?option=com_advsearch&view=advsearch&layout=test&var=".$post['var'];
?>
<form method="post" action="<?php echo $newlink; ?>">
<input type="hidden" name="var" value="example"/>
<input type="submit" value="Submit"/>
</form>
Link
Joomla adds a base tag to the head of the page. I assume that must strip any parameters.
edit: A test tells me that Joomla does strip parameters for that tag. If you view your source, it will probably have the code:
<base href="localhost/joomla/index.php/users_hosts_list">
This will cause the link to be localhost/joomla/index.php/users_hosts_list# rather than just a #
When you replace the "#" with the real url it should work.
I am testing Html form using post method and got this odd result:
I have two html pages on server apache (already installed php): post.html and target.html, and the code for these page are followings:
post.html (don't worry about the html standard)
<div style="text-align: center">
<form method="POST" action="target.html">
<input type="text" name="testname" value="sometext" />
<input type="submit" value="submit" />
</form>
</div>
and target.html
<html>
<head>
</head>
<body>
<h1>Target page</h1>
</body>
</html>
When I entered data to the form on post.html page and hit submit button, I got to the target.html page. When on this page(target.html), I refreshed the page, and what I receive is a blank page. The second time I refreshed, It turned to normal Html page.
I don't know why it returned a blank page the first time I refreshed, I have tried the same approach but with PHP page, and the content of target page (assum name target.php) still remains (not blank like html files above)
So, could you explain me about this problem?
Thank you.
This definitely has something to do with your browser. Same here on a mac using Safari, on some pages after submitting the content, the page seems to freeze, I refresh it, and then it works again.
Definitely not a code problem, as far as I'm concerned.
It's because you cannot pass an input from html to html file. Your target.html should be a php file (target.php).
and try to put this code on your target.php
<?php
var_dump($_POST); //this will show the inputted text and also show the data type and will stop the code execution here. other codes below will not be executed.
echo $_POST['testname'];
?>
Additionally, change target.html to target.php in your form action
First I will start out by correcting your post.html
<div style="text-align: center;"> <!-- added a ; after center -->
<form method="POST" action="target.html">
<input type="text" name="testname" value="sometext" />
<input type="submit" value="submit" />
</form>
</div>
that may not matter but you should end all your styles with ;
To continue, everything looks fine. maybe something weird happened between refreshes.
save your form page in php than add the php script in the same page, here try this. remember save in .php.
<?php $testname = $_Post['testname'];
echo $testname ?>
<div style="text-align: center">
<form method="POST" action="">
<input type="text" name="testname" value="sometext" />
<input type="submit" value="submit" />
</form>
</div>