Database question
How do I add a button to a page that would clear any url parameters and reload the page?
dean
How do I add a button to a page that would clear any url parameters and reload the page?
dean
Dean,
One way to do this where you can ensure that you are clearing the URL parameters is to add a button that goes to an "in-between" page that includes a redirect back to the page you are on.
For example, if your page is "mypage.php" and it currently has a URL variable such as "mypage.php?id=1"
You could create a hyperlink on your button to go to "refreshmypage.php"
On the page "refreshmypage.php", you would clear out all the code and just put the php redirect code, such as this:
<?php header("Location: mypage.php");
exit;
?>
Now the page will seamlessly redirect through the refresh without the user noticing that it actually went through a new page to create the clearing instance of the URL parameters.
Keep in mind, you can use this method a lot of different ways... you may not need to use a button, but instead just have this triggered by another behavior such as a database update or email sent, etc.
Best regards,
Brian
So if I follow you... then my insert user record form button could redirect to this refresh page and then just redirct back to the now empty form. No extra code is required on the refresh page right? If this is correct then you my friend... kick ass!
next question is... I have a form that has a date field. I use a popup calendar to help the user choose the date. What I need to add is a dropdown menu that will allow them to choose Am, PM or Night to go into the same database field as the date. I have the dropdown but obviously a twist in the code is needed because the dropdown selection just replaces the date in the database. basically, can 2 textfields get inputed into 1 database field.
Dean,
Yes to your first question... you can really set anything you want to make the redirect trigger... the method your describing would work.
For your next question, just so I understand, you want to collect just the date and then am or pm... meaning you're not collecting the time, as well?
You could bring the two results together if necessary through concatenation, but why not just have two separate columns (one for date and one for time of day)?
Cheers,
Brian
correct, not collecting the time. I thought about the extra column for am/pm/nite but then another question comes up. Which is i could not get DA to search the database for both date and am/pm/nite. As long as i can get results back based on just the date alone or with am/pm or nite then it really doesn't matter to me. Which is easier or more accepted.
dean
Dean,
If you are just collecting the time of day, such am or pm, I would keep it separate from the date column.
I would only combine the two if you were considering a full date/time stamp such as "2009-10-18 22:00:00".
But since the exact time is not what you are looking for, I would go to two separate columns.
As far as searching both, why couldn't you search by both attributes. It would be real simple, actually.
In your search form, you would just run validation to ensure that a time of day was selected (which would happen automatically if you used a drop down menu for the time of day column).
So, I would have your date field be text in the search and then add a drop down menu for time of day that only included "am" or "pm" with the appropriate values and then add validation to the form to ensure that am or pm was selected and then search away.
Cheers,
Brian
Ok i follow you. so the problem i have now is I don't think its real clear how to make Dataassist search wizard search two columns and return the results i'm looking for, which is why i was askindg about inserting two fields into one. for example: I need to be able to do 2 things.
1 search a date like 10/12/2009 and get a list of all rows with that date.
2 add am/pm/nite to the serch and get just the rows with both the date and the am/pm or nite .
it sounds simple but this is one of those "can't find the how to section " on this.
I appreciate ur help
Dean
Create a View in your database to return the AM/PM value. Then you can search that field as part of your View.
If you can't do views because of your MYSQL version, you can probably do it in the recordset directly... either way the syntax will be something like:
SELECT *, DATE_FORMAT(yourDateColumn,'%p') AS AMPMValue FROM yourTable
Then you should be able to search based on the AMPMValue column as if it were a text column in your database.
ok, I'm working thruogh this slowly. I stiil don't understands DA search wizard so that question still applies. The new problem is passing a url with more than on parameter. I currently have:
{WADAtripinfo.Month}/{WADAtripinfo.Day}/{WADAtripinfo.Year}{WADAtripinfo.ampm} is a hyperlink to the booking_results.php page setup as follows...
booking_results.php?Date=<?php echo $row_WADAtripinfo['Month']; ?>
How do I get this to include Day, Year and ampm?
and will the recordset on booking_results.php understand these parameters and display only the records that have all three a match?
I am assuming url is the way to go or would session or cookie be better.
Dean
Didn't see your reply before. I hate to say that was way over my head. Does this view get put on a particular page? I've never used veiws befor, what exactly is a view?
Dean
Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.
These out-of-the-box solutions provide you proven, tested applications that can be up and running now. Build a store, a gallery, or a web-based email solution.