I've tried looking online before actually asking for help, but I've been looking for about the past 3-5 hours and have found nothing that'll help me.
This is a project for school, and well I have to use Access as a database. I am using PHP for coding, and I'm fairly new to PHP. Now for the problem...
When I type in a Name in my Text Field all is good, I hit submit it works, if I hit reset it resets. My issue happens after I hit submit once the item is added, then if I refresh the page the item is added again, and it happens as many times as I hit refresh. I've tried numerous ways to make my text fields clear. I'm not coming up with anything. I started out having two files a PHP and HTML, I combined them hoping I could figure out a way to fix this, but to no avail.
If you look at my code you'll find that "odbc_exec($conn,$input);" is missing I took it out cause I have no idea where to put it, or what to do with it, or how to clear the fields upon having that executed.
If anyone could help me even the tiniest bit that'd be great
Code: <?php
$conn=odbc_connect('database','','');
if (!$conn)
{exit("Connection Failed: " . $conn);}
$Name = $_POST["Name"];
$Submit = $_POST["Submit"];
$Reset = $_POST["Reset"];
$input="INSERT INTO Registry (FirstName) VALUES('$Name')";
$sql="SELECT * FROM Registry";
$rs=odbc_exec($conn,$sql);
?>
<html>
<body>
<form name="TestForm" method="POST" action="<?php echo $_SERVER['PHP_SELF'] ?>">
Name: <input type="text" name="Name" maxlength=50/>
<p>
<input type="submit" name="Submit" value="Submit">
<input type="reset" name="Reset" value="Reset">
</form>
</body>
</html>
<?php
if (!$rs)
{exit("Error in SQL");}
echo "<table><tr>";
echo "<th>FirstName</th>";
echo "<th>LastName</th></tr>";
//Writes Table Values
while (odbc_fetch_row($rs))
{
$firstname=odbc_result($rs,"FirstName");
$lastname=odbc_result($rs,"LastName");
echo "<tr><td>$firstname</td>";
echo "<td>$lastname</td></tr>";
}
odbc_close($conn);
echo "</table>";
?>
Delete Client 066 Earlywatch
Hi all,
setcookie and isset($_COOKIE(name)) seem very finnicky.
I'm currently playing around with a user system with login and registration. I'm trying to use cookies to log the user in but the cookie either doesn't set or it sets after I travel through a few
PHP4 to PHP5 Conversion
Hi Everyone,I am working on a site that is built up on PHP4 and each page is being started from <? instead of <?php as of PHP5.I want to convert this <? to <?php on every
How to read CSS message data
Hi,
Nested (echoed) php running wrong script
Got a problem with a php website I'm creating.In a nutshell, the first page is entirely html and calls a php script to process an uploaded file and some form fields using POST. After validating the
Add "width" check when upload
Hi!Can someone add a function that is checking if picture witdh is bigger then 800px whwn uploading, then echo "image oversized" to the code below?Code: <?php ###/ VARIABLES -
PHP Include not working
The website is http://www.grlistingservices.comThe code block is as follows:<?phpif (!isset($id)){include 'home.php';}else{include "$id.php";}?>All files are in the same
php not working written for consumption of slots
1. Here is the function where i will be allowed to consume the slot booked by me.2. Here i check the unique reservation id, current server time & date.3. Then i ask the user to enter the
php require help needed
Ok i tried to use the search funtion but the word require is everywhere.i'm really new to creating websites... I've built them in the past but allways had some sort of template to go off of from a
help with image text
Hi ...see i need the text of the name and number to start in the center and always be in the center now with the code i have the text starts in the center and goes on to the rite it does not stay in