PDA

View Full Version : form submission help


VodkaFish
01-18-2004, 11:10 PM
I've got a page outside of vb that works with some of the vb elements (mainly, it's a members-only page).

I've got a lot of it working; the login, the correct info displayed, and correct form stuff setup.

I've got the submit that I want to do with the form, but I'm not sure how to go about it. Here's what I mean: I've got the insert statement I want, and an if/else statement for a couple of the fields of the form - but I'm not quite sure how to do it within the same page and the display a simple "thank you" (like after submitting a post) and then kick you back out to the page that originally led you to the form in the first place.

Does that make sense? Hope so :) Let me know if I can clear anything up, and I hope someone can point me in the right direction. My php is iffy, but I'm getting by so far.

NTLDR
01-19-2004, 11:08 AM
Here is the basic code to go on: In the form HTML make the file the form submits to the same as the file thats displaying the form and make sure this hidden input field is added:

<input type="hidden" name="action" value="update">

Then in your PHP, near the top before you do the stuff to display the form:


if ($_POST['action'] == 'update') {
// your code here to process the form data, which is in the $_POST array
// your query

// lets redirect the user -- make sure your change the url
$url = "URL_TO_REDIRECT_TO";
// replace PHRASE_NAME with a title for the phrase you want to show, ie the thanks message and add it to the Front-End Redircet Message group
eval(print_standard_redirect('redirect_PHRASE_NAME '));
}

VodkaFish
01-19-2004, 02:59 PM
$url = $_SERVER['HTTP_REFERRER'];

will that work if I just want to dish them back to the page that sent them?

NTLDR
01-19-2004, 03:01 PM
Yep :)

VodkaFish
01-20-2004, 05:27 AM
$url = $_SERVER['HTTP_REFERRER'];

will that work if I just want to dish them back to the page that sent them?
I wound up having to use:
$_SERVER['HTTP_REFERER']
as: $_SERVER['HTTP_REFERRER'] wouldn't work

Is it spelt differently in UK-English or something? Any spell check/dictionary I know of spells it referrer (as I was taught and even as programs like DW output it). Luckily, I found out the quirk through Google.