Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

help with php mail function -- and MORE 1

Status
Not open for further replies.

deecee

Technical User
Aug 25, 2001
1,678
US

if you go here you see a form where you can submit your email. I have a javascript validator on it so I'm not to concerned about using php to validate. heres the questions

1) when you hit submit the form is passes to email.php and processed and you get a little thank you. How can I instead of going to a new page run the email.php script through a new layer that the user could just close. Or how could I open it in a new window with x width and height and centered?

2) Also After they have submitted their email how would I go about always displaying it in the top left of the webpage kinda like a username?

3) Anyone here use Phakt and Dreamweaver? I have a question about connecting to a database with localhost. Prettymuch I thought you needed an address to connect to a mysql database (ip, or webaddress) how do you connect using local host with username "host" and pass "test"?

I know this is a lot but I am starting to get into this php stuff more! [soapbox]
sleep is good
 
Since you're already using javascript, here'd be my suggestions.

1) Make the form submit button a button type and have it call a javascript function which instead of submitting the form just passes all the variables in a query string to the a new window which calls the php script.... that's all javascript though... if you need to know how to do it let me know.

2) cookies, choose javascript or php here, I like php cookies better myself

3) Never used either, sorry.

-Rob
 
thanks for the response.

For the first one yes I need to know. Or at least get pointed in a direction.

how would i set up the cookie in the first place? [soapbox]
sleep is good
 
Ok, so below is an example of the javascript function... you would change your <form> tag such that it had no action or really you wouldn't care because you're never submitting it.

then your button is
<input type=button name=&quot;Blah&quot; value=&quot;blah&quot; onClick=&quot;Neato()&quot;>

then up inside your head and script tags you have this function
Code:
function Neato() {
    theForm = document.testFormName
    var product = theForm.Input1.value;
    var version = theForm.Input2.value;
    var query = &quot;?var1=&quot;+ product+
                &quot;&var2=&quot;+ version;

    var newwindow = window.open(&quot;[URL unfurl="true"]http://url/info/email.php&quot;+query,&quot;NewWindowTitleHere&quot;,[/URL] &quot;height=300,width=600,location=0,status=0,scrollbars=0,resizable=1, left=580, top=10,screenX=580,screenY=10&quot;); 
    newwindow.focus();
  }
}

And for the cookie issue, use the setcookie() function in php...


I'll let someone more capable explain the details of php cookies, I can use'm but don't know them inside and out.

-Rob
 
ahh fascinating...Ill give it a try when i get home and let you know. thanks m8 [soapbox]
sleep is good
 
nah it does the same as setting target to _blank in the form tag...but its a nice alternative to know [soapbox]
sleep is good
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top