View Full Version : Request for a VTM

03-08-2006, 08:19 PM
Hey Guys/Gals,
I have a request for a VTM. I have been playing with the idea and I know it can be done but i just can't wrap my head around it.

What I am trying to do is have a submitted form echo display to the screen, email to various people including the submitter and populate a MySQL database. I can do all three individually but trying to combine them is making me CRAZY!!

Let me know what you think??

03-09-2006, 08:54 AM
can you write each individual task yourself??

if you have the skills to do these tasks then its easy to do all three together

03-09-2006, 02:15 PM
I realize it may be easy to someone who has done it many times before, I however have not. I can do all three, s-l-o-w-l-y but I can do them. I just need a hand in tying them together.


03-09-2006, 02:38 PM
i understand this and have been there before. i was trying to get an idea of your skill level so i know how much detail to give you


PHP runs from top to bottom processing comands as it reads through them
if you had a button calling the same page....
<input name="Button" type="button" value="Button" onClick="location.href='this_page.php?go=1'">

as you can see i am sending a var go to the same page which equals 1

catch this in a $_GET['go'];

$go = $_GET['go'];

then wrap your 3 tasks in an IF

/// $printform = $formElements; >>> this gets you form info and assigns to $printform. Replace $formElements; with your form field vars. Just echo $printform to the page where you want to display it

/// mail() is where you would add your email function

/// next add your update db statement

IF($go == 1){

$printform = $formElements;

email here;

Update statement here


as you can see in my pseudo code example its just a simple case of adding each task after the other

If you have an insert statement. After the code of that statement just add an echo 'hello';

you should see the insert take place and HELLO should echo to the screen
This test has proven that you have performed 2 tasks

do you understand this so far??

03-09-2006, 03:04 PM
Hmm... ok.
I will take some time to digest this and see what I come up with. Thanks so much for the help...so far. I would imagine i will have a couple more questions for you after trying this out.

03-09-2006, 03:17 PM
best way is to get each seperat element of your script working in different pages


once your happy then its simple to copy each script into one page

03-09-2006, 03:25 PM
anotherway is to write an insert statement which populates a db in page1.php

then in page2.php write your email function

then in page3.php write your echo function

make sure they all work when you run them and make sure each page just contains PHP.
Just a 3 blank pages which looks like ...


php script here


once you have all 3 scripts running then in your main page just add...


03-09-2006, 03:31 PM
I like that idea!!
I will try it out...