On 2010-02-17 01:44:56AM -0800, Tom Lloyd wrote:
> Hi All,
> 
> 
> Thank you for your previous help getting rivet running. I am now trying to 
> get it to work with simple html forms and a mysql database. I am at the stage 
> that I have a form filled with data which I can read manipulate/verify and is 
> ready for submission into the database. I have three buttons that call the 
> rivet script with different names. Can you take the buttons name that calls 
> the script and perform an action based on that information? How do I access 
> that information in my script? I have really struggled to find any 
> comprehensive rivet examples. 
> 
> 1. I would like information such as which page called the script.

load_env ARRAY

puts "Script name: $ARRAY(SCRIPT_NAME)"

> 2. Which button was pressed to call differing actions on the data.

Well you could set a flag via a hidden form variable and then read that via

var get formvariablename

Or use javascript onclick() that will lead to an XMLHttpRequest, but AJAX
is a bit beyond what you're looking for I think :)

There is 1 submit button per form. If you want multiple buttons then you
need to instantiate multiple forms.
 
> 3. If anyone has some good rivet reading / examples I would really appreciate 
> them. 
> 
> Very new to web scripting so please bare with me, if there is some essential 
> reading I should do first on html etc any clues would be appreciated.

form.html:

<form action="nextpage.rvt" method="POST">
Enter your Name here: 
<input name="name" length="25">
<BR>
<input type="hidden" name="buttonpressedflag1" value="1">
<input type="submit">
</form>

nextpage.rvt:
<?
load_env ENV

set name [ var get name ]

set flag [ var get buttonpressedflag1 ]

puts "Hello $name!<BR>"

if {$flag == 1} {
   puts "also flag was tripped"
}
puts "<BR>"

puts "Script name: $ENV(SCRIPT_NAME)"
?>

-- 
===========================================================
Peter C. Lai                 | Bard College at Simon's Rock
Systems Administrator        | 84 Alford Rd.
Information Technology Svcs. | Gt. Barrington, MA 01230 USA
peter AT simons-rock.edu     | (413) 528-7428
===========================================================


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to