Help with PHP script to Coldfusion
I have a PHP script that I need to create in coldfusion. I'm
fairly new to coldfusion and would appreciate any help. Here is the
PHP script... The code is suppose to retrieve the HTTP POST data
from the url. I would be open to doing this in Javascript as well.
Thanks again...
/* Script Start */
//Get the file POST data
$filePost = $_POST[$filePostVariable];
//Break the file list into an array
$filePost = explode($fileDelimiter, $filePost);
<cfset arrayList = ListToArray(url.urlVar)>
I accessed the URL vars directly via url scope, and the
default delimiter is comma otherwise add a delimiter to the
listToArray function. In the PHP example it looks like you had a
var that held the url var name. I hope this helps.
Trevor
Visit Me
Similar Messages
-
Can anyone help me with this problem. I have designed a form
for a catalogue request that i want to be emailed to me after
submitting, I am using Fasthosts and need to use their settings. i
have been able to do their basic feedback form and that has worked
but when i have tried to change it to send my own form i am
struggling. i/ have never done PHP before and know i need to learn
quick! I have checked all the script and the message i am getting
now is a problem with the actual sending part. This is the code i
have used
$sent = mail($email_to, $emailSubject, $message,
$headers,'-f.$email_from') ;
if ($sent)
/*If sent direct customers to thankyou page */
header( "Location:
http://www.cicomol.co.uk.co.uk/thankyou.html"
} else {
/* If there is an error display an error message */
echo 'There has been an error sending your comments. Please
try later.';
?>
Can anyone give me a clue?
thanks so much
regardshighbank64 wrote:
> But now i can only get the name and comments to show on
the email i receive.
> Can some please let me know the best way to add the
other fields onto my
> script. I don't understand the \n bits!
Using a language like PHP without understanding it is an
invitation to
security problems. Everyone is a beginner to start with, so
there's
nothing wrong with not knowing how a script works at the
outset, but you
need to get the basics under your belt pretty quickly.
Otherwise, you
are laying the foundation for lots of headaches.
OK, lecture over. "\n" is the way that PHP (and other
languages) inserts
a newline character.
> my code at the moment is
> $message= "Name: ".$name . "\nComments: ".$comments;
So, "\nComments: " simply puts a newline before Comments. The
period
(full stop) concatenates (joins together) different parts of
a string.
You can also add to an existing string by using .= (the
combined
concatenation operator).
Assuming the form is submitted using the POST method, you get
the values
of other fields by adding the name of the field in quotes
between the
square brackets of $_POST[] (POST must be uppercase) like
this:
$message = "Name: $name";
$message .= "\nComments: $comments";
$message .= "\nPhone: " . $_POST['phone'];
$message .= "\nEmail: " . $_POST['email'];
David Powers, Adobe Community Expert
Author, "The Essential Guide to Dreamweaver CS3" (friends of
ED)
Author, "PHP Solutions" (friends of ED)
http://foundationphp.com/ -
Update on help with PHP to send an email
On Jan 9th Iasked for help Asking for help with PHP to send an email wanting to send myself an email when a particular web page was opened.The group gave me lots of ideas / suggestions but unfortunately I was not able to make it work the way I wanted. But.. with perseverance.. made it work. The original PHP code I wanted to use was:
<?php mail('[email protected]','Subject of the e-mail','This is the body of the e-mail!'); ?>
After much trial and error. this is what I found works.. for me at any rate. My log in sets a cookie that welcomes my user back by name so I ended up using that information with this:
<?php
if (isset($_COOKIE["last_in"])) {
$user = $_COOKIE["last_in"];
mail('[email protected]','News Page',"$last_in");
?>
Again, thank you for all the help with my initial question.. there are a multitude of ways to accomplish a task, and for me this is the one I was looking for.On Jan 9th Iasked for help Asking for help with PHP to send an email wanting to send myself an email when a particular web page was opened.The group gave me lots of ideas / suggestions but unfortunately I was not able to make it work the way I wanted. But.. with perseverance.. made it work. The original PHP code I wanted to use was:
<?php mail('[email protected]','Subject of the e-mail','This is the body of the e-mail!'); ?>
After much trial and error. this is what I found works.. for me at any rate. My log in sets a cookie that welcomes my user back by name so I ended up using that information with this:
<?php
if (isset($_COOKIE["last_in"])) {
$user = $_COOKIE["last_in"];
mail('[email protected]','News Page',"$last_in");
?>
Again, thank you for all the help with my initial question.. there are a multitude of ways to accomplish a task, and for me this is the one I was looking for. -
Create HTML Contact Form with PHP script
Hi Everyone
I have designed a contact form in HTML with PHP script but it doesn't seem to be working. The PHP echo message doesn't appear after I submit the form and the e-mail message is not delivered. The url address is http://www.dreamaustraliastudytours.com.au/Test/ContactUs.html. Any thoughts would be greatly apprecipated
Thank you in advance
PaulHi Ben and Murray
Thank you for your input on the php script. You nailed the problem on the head. I have up dated the script and provided it below. I have one more question.
After the end user submits the form I would like them to be directed to another html file - for example successful.html. Would the code be
$insertGoTo = "successful.html";
delete 'Thank you for contacting us. We will be in touch with you very soon.'?
Once again thank you for your advice
Regards
Paul
<?php
if(isset($_POST['email'])) {
$email_to = "[email protected]";
$email_subject = "New Inquiry";
function died($error) {
// your error code can go here
echo "We are very sorry, but there were error(s) found with the form you submitted. ";
echo "These errors appear below.<br /><br />";
echo $error."<br /><br />";
echo "Please go back and fix these errors.<br /><br />";
die();
// validation expected data exists
if(!isset($_POST['first_name']) ||
!isset($_POST['last_name']) ||
!isset($_POST['email']) ||
!isset($_POST['telephone']) ||
!isset($_POST['comments'])) {
died('We are sorry, but there appears to be a problem with the form you submitted.');
$first_name = $_POST['first_name']; // required
$last_name = $_POST['last_name']; // required
$email_from = $_POST['email']; // required
$telephone = $_POST['telephone']; // not required
$comments = $_POST['comments']; // required
$error_message = "";
$email_exp = '/^[A-Za-z0-9._%-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,4}$/';
if(!preg_match($email_exp,$email_from)) {
$error_message .= 'The Email Address you entered does not appear to be valid.<br />';
$string_exp = "/^[A-Za-z .'-]+$/";
if(!preg_match($string_exp,$first_name)) {
$error_message .= 'The First Name you entered does not appear to be valid.<br />';
if(!preg_match($string_exp,$last_name)) {
$error_message .= 'The Last Name you entered does not appear to be valid.<br />';
if(strlen($comments) < 2) {
$error_message .= 'The Comments you entered do not appear to be valid.<br />';
if(strlen($error_message) > 0) {
died($error_message);
$email_message = "Form details below.\n\n";
function clean_string($string) {
$bad = array("content-type","bcc:","to:","cc:","href");
return str_replace($bad,"",$string);
$email_message .= "First Name: ".clean_string($first_name)."\n";
$email_message .= "Last Name: ".clean_string($last_name)."\n";
$email_message .= "Email: ".clean_string($email_from)."\n";
$email_message .= "Telephone: ".clean_string($telephone)."\n";
$email_message .= "Comments: ".clean_string($comments)."\n";
// create email headers
$headers = 'From: '.$email_from."\r\n".
'Reply-To: '.$email_from."\r\n" .
'X-Mailer: PHP/' . phpversion();
@mail($email_to, $email_subject, $email_message, $headers);
?>
Thank you for contacting us. We will be in touch with you very soon.
<?php
?> -
Need help with PHP mail script
I have created a log in system . In that when the user completes the registration process an auto reply(auto-reply@domain) will generate and sent this to users email id regarding about the user name and password (Lo gin Details). After formal approval from the admin the user will get a user activation mail with log in link.
But , my problem is these are work only for mail accounts from my domain only(test@domain). its not send any of above mentioned details to other mail services like gmail or yahoo etc.
i discussed this with some others, they said its the problem with your mail function configuration. but i didn't get any needful information as am a beginner in PHP scripting.
i have contacted this with my hosting service they said its the problem with php mail () function and use php mailer() instead mail().
please give me a solution for the same..
Here am ataching my code..
<?php
include 'dbc.php';
$err = array();
if($_POST['doRegister'] == 'Register')
foreach($_POST as $key => $value) {
$data[$key] = filter($value);
if(empty($data['full_name']) || strlen($data['full_name']) < 4)
$err[] = "ERROR - Invalid name. Please enter atleast 3 or more characters for your name";
//header("Location: register.php?msg=$err");
//exit();
// Validate User Name
if (!isUserID($data['user_name'])) {
$err[] = "ERROR - Invalid user name. It can contain alphabet, number and underscore.";
//header("Location: register.php?msg=$err");
//exit();
// Validate Email
if(!isEmail($data['usr_email'])) {
$err[] = "ERROR - Invalid email address.";
//header("Location: register.php?msg=$err");
//exit();
// Check User Passwords
if (!checkPwd($data['pwd'],$data['pwd2'])) {
$err[] = "ERROR - Invalid Password or mismatch. Enter 5 chars or more";
//header("Location: register.php?msg=$err");
//exit();
$user_ip = $_SERVER['REMOTE_ADDR'];
// stores sha1 of password
$sha1pass = PwdHash($data['pwd']);
// Automatically collects the hostname or domain like example.com)
$host = $_SERVER['HTTP_HOST'];
$host_upper = strtoupper($host);
$path = rtrim(dirname($_SERVER['PHP_SELF']), '/\\');
// Generates activation code simple 4 digit number
$activ_code = rand(1000,9999);
$usr_email = $data['usr_email'];
$user_name = $data['user_name'];
$rs_duplicate = mysql_query("select count(*) as total from users where user_email='$usr_email' OR user_name='$user_name'") or die(mysql_error());
list($total) = mysql_fetch_row($rs_duplicate);
if ($total > 0)
$err[] = "ERROR - The username/email already exists. Please try again with different username and email.";
if(empty($err)) {
$sql_insert = "INSERT into `users`
(`full_name`,`user_email`,`pwd`,`address`,`tel`,`fax`,`website`,`date`,`users_ip`,`activa tion_code`,`country`,`user_name`
VALUES
('$data[full_name]','$usr_email','$sha1pass','$data[address]','$data[tel]','$data[fax]',' $data[web]'
,now(),'$user_ip','$activ_code','$data[country]','$user_name'
mysql_query($sql_insert,$link) or die("Insertion Failed:" . mysql_error());
$user_id = mysql_insert_id($link);
$md5_id = md5($user_id);
mysql_query("update users set md5_id='$md5_id' where id='$user_id'");
// echo "<h3>Thank You</h3> We received your submission.";
if($user_registration) {
$a_link = "
*****ACTIVATION LINK*****\n
http://$host$path/activate.php?user=$md5_id&activ_code=$activ_code
} else {
$a_link =
"Your account is *PENDING APPROVAL* and will be soon activated the administrator.
$message =
"Hello \n
Thank you for registering with us. Here are your login details...\n
User ID: $user_name
Email: $usr_email \n
Passwd: $data[pwd] \n
$a_link
Thank You
Administrator
$host_upper
THIS IS AN AUTOMATED RESPONSE.
***DO NOT RESPOND TO THIS EMAIL****
mail($usr_email, "Login Details", $message,
"From: \"Member Registration\" <auto-reply@$host>\r\n" .
"X-Mailer: PHP/" . phpversion());
header("Location: thankyou.php");
exit();
?>I have created a log in system . In that when the user completes the registration process an auto reply(auto-reply@domain) will generate and sent this to users email id regarding about the user name and password (Lo gin Details). After formal approval from the admin the user will get a user activation mail with log in link.
But , my problem is these are work only for mail accounts from my domain only(test@domain). its not send any of above mentioned details to other mail services like gmail or yahoo etc.
i discussed this with some others, they said its the problem with your mail function configuration. but i didn't get any needful information as am a beginner in PHP scripting.
i have contacted this with my hosting service they said its the problem with php mail () function and use php mailer() instead mail().
please give me a solution for the same..
Here am ataching my code..
<?php
include 'dbc.php';
$err = array();
if($_POST['doRegister'] == 'Register')
foreach($_POST as $key => $value) {
$data[$key] = filter($value);
if(empty($data['full_name']) || strlen($data['full_name']) < 4)
$err[] = "ERROR - Invalid name. Please enter atleast 3 or more characters for your name";
//header("Location: register.php?msg=$err");
//exit();
// Validate User Name
if (!isUserID($data['user_name'])) {
$err[] = "ERROR - Invalid user name. It can contain alphabet, number and underscore.";
//header("Location: register.php?msg=$err");
//exit();
// Validate Email
if(!isEmail($data['usr_email'])) {
$err[] = "ERROR - Invalid email address.";
//header("Location: register.php?msg=$err");
//exit();
// Check User Passwords
if (!checkPwd($data['pwd'],$data['pwd2'])) {
$err[] = "ERROR - Invalid Password or mismatch. Enter 5 chars or more";
//header("Location: register.php?msg=$err");
//exit();
$user_ip = $_SERVER['REMOTE_ADDR'];
// stores sha1 of password
$sha1pass = PwdHash($data['pwd']);
// Automatically collects the hostname or domain like example.com)
$host = $_SERVER['HTTP_HOST'];
$host_upper = strtoupper($host);
$path = rtrim(dirname($_SERVER['PHP_SELF']), '/\\');
// Generates activation code simple 4 digit number
$activ_code = rand(1000,9999);
$usr_email = $data['usr_email'];
$user_name = $data['user_name'];
$rs_duplicate = mysql_query("select count(*) as total from users where user_email='$usr_email' OR user_name='$user_name'") or die(mysql_error());
list($total) = mysql_fetch_row($rs_duplicate);
if ($total > 0)
$err[] = "ERROR - The username/email already exists. Please try again with different username and email.";
if(empty($err)) {
$sql_insert = "INSERT into `users`
(`full_name`,`user_email`,`pwd`,`address`,`tel`,`fax`,`website`,`date`,`users_ip`,`activa tion_code`,`country`,`user_name`
VALUES
('$data[full_name]','$usr_email','$sha1pass','$data[address]','$data[tel]','$data[fax]',' $data[web]'
,now(),'$user_ip','$activ_code','$data[country]','$user_name'
mysql_query($sql_insert,$link) or die("Insertion Failed:" . mysql_error());
$user_id = mysql_insert_id($link);
$md5_id = md5($user_id);
mysql_query("update users set md5_id='$md5_id' where id='$user_id'");
// echo "<h3>Thank You</h3> We received your submission.";
if($user_registration) {
$a_link = "
*****ACTIVATION LINK*****\n
http://$host$path/activate.php?user=$md5_id&activ_code=$activ_code
} else {
$a_link =
"Your account is *PENDING APPROVAL* and will be soon activated the administrator.
$message =
"Hello \n
Thank you for registering with us. Here are your login details...\n
User ID: $user_name
Email: $usr_email \n
Passwd: $data[pwd] \n
$a_link
Thank You
Administrator
$host_upper
THIS IS AN AUTOMATED RESPONSE.
***DO NOT RESPOND TO THIS EMAIL****
mail($usr_email, "Login Details", $message,
"From: \"Member Registration\" <auto-reply@$host>\r\n" .
"X-Mailer: PHP/" . phpversion());
header("Location: thankyou.php");
exit();
?> -
Template with php script, white space around background, locking layers
two questions for 2 sites:
1.) first site http://www.beckervanhoveln.com
I can't get my background to line up correctly; there is a giant white border around the whole thing. With the amount of extra space around the background on all sides, I think it may be an issue with the illustrator file I am importing, but I can't see any way to fix it there, either. All the margins that I can find to change relating to that background are set to 0. Any ideas on what could be causing this? The image in Illustrator is 14" wide, so it's plenty wide enough to cover the whole page.
2.) site http://sai.theclothesgallery.com
I inserted php scripts into a page (in the editable paragraph region) and it is messing up the alignment of the page. Compare what you get on the home page with what you get when you click the "client login" button. Also, wondering where the extra body area came from on page http://sai.theclothesgallery.com/protected_downloads_zdr/validuser.php.
On both sites I am using wrapper and body tags, as directed in the tutorial by Nate (great one, thanks!). On my old site, http://www.theclothesgallery.com, everything works fine, but on the new ones I am just out of my mind. I've spent 10 hours over the last 2 days doing research and trying to manipulate code, to no avail. Thanks to anyone who can help.
Finally, is there a way to lock a layer inside or on top of another layer. for example, the layer the body text is in on site http://sai.theclothesgallery.com is on top of the layer that holds the page's images (which is an imported illustrator file with slices). Is there a way to lock that layer to the first one so it doesn't move if I make changes?Kelly,
1. The image itself has a white border. You will need to crop that image
in an image editor such as Photoshop.
2. Looking at the source of the page you have two sections and
two opening toags but only one closingtag. The PHP
script is probably creating the additional sections, but without seeing
the script it is impossible to say for certain.
2a. You probably have a space or blank line before the opening -
Connect to oracle database with php script
Hello!
How can I connect to an Oracle database with a PHP script? I read about it at www.php.net:
"Oracle 8 functions; These functions allow you to access Oracle8 and Oracle7 databases. It uses the Oracle8 Call-Interface (OCI8). You will need the Oracle8 client libraries to use this extension."
Where can I get these libraries from?
Who knows more about the issue?
Thanks a lot for your help!
Martin
nullHello
<BLOCKQUOTE><font size="1" face="Verdana, Arial">quote:</font><HR>Originally posted by mheibel([email protected]):
Hello!
How can I connect to an Oracle database with a PHP script? I read about it at www.php.net:
"Oracle 8 functions; These functions allow you to access Oracle8 and Oracle7 databases. It uses the Oracle8 Call-Interface (OCI8). You will need the Oracle8 client libraries to use this extension."
Where can I get these libraries from?
Who knows more about the issue?
Thanks a lot for your help!
Martin<HR></BLOCKQUOTE>
Install and put working a sqlnet working client (install the Oracle Client option of the Oracle Database CD ROM). Than compile php with the --oci option. Than try the samples in php.net (oci function in the help).
These are the steps... Put everything working is a little more complicated...
FS
null -
Need help with PHP contact form
Hi guys,
I've made a PHP contact form for my site and need help with a couple of things:
The form action links an external PHP script (scripts/contact-form-script.php) but is there a way I can have it so the PHP script for the form is contained within the same PHP file as my contact form (contact.php)?
I tried just putting the form code at the top of contact.php but the browser automatically reads the anti-spam re-direct, so maybe that needs revising too?
The second thing is, how can I make the Name, Email and Message fields mandatory? So if a user tries to submit the form and hasn't filled in one of the required fields and clicks submit, contact.php reloads with a message at the top of the form saying something like 'Complete the required fields' and highlights the relevant field with a red border?
Here's the code for contact.php:
<form action="http://www.mydomain.com/scripts/contact-form-script.php" method="post" name="contact" id="contact">
<p><strong>Name:*</strong><br />
<input name="name" type="text" class="ctextField" /></p>
<p><strong>E-mail:*</strong><br />
<input name="email" type="text" class="ctextField" /></p>
<p><strong>Telephone:</strong><br />
<input name="telephone" type="text" class="ctextField" /></p>
<p><strong>Company:</strong><br />
<input name="company" type="text" class="ctextField" /></p>
<p><strong>Address:</strong><br />
<input name="address1" type="text" class="ctextField" /></p>
<p><input name="address2" type="text" class="ctextField" /></p>
<p><strong>Town:</strong><br />
<input name="town" type="text" class="ctextField" /></p>
<p><strong>County:</strong><br />
<input name="county" type="text" class="ctextField" /></p>
p><strong>Postcode:</strong><br />
<input name="postcode" type="text" class="ctextField" /></p>
<p><strong>Message:*</strong><br />
<textarea name="message" cols="55" rows="8" class="ctextField"></textarea></p>
<p><input name="submit" value="SEND MESSAGE" class="submitButton" type="submit" /><div style="visibility:hidden; width:1px; height:1px"><input name="url" type="text" size="45" id="url" /></div></p>
</form>
And this is the PHP I'm using to submit the form data for contact-form-script.php:
<?php
$headers .= "Reply-To: " . $_POST["email"] . "\r\n";
$to = "[email protected]";
$subject = "Contact from website";
$message = $headers;
$message .= "Name: " . $_POST["name"] . "\r\n";
$message .= "E-mail: " . $_POST["email"] . "\r\n";
$message= '
<table cellspacing="0" cellpadding="8" border="0" width="500">
<tr>
<td colspan="2"></td>
</tr>
<tr bgcolor="#eeeeee">
<td width="154" style="font-family:Verdana, Arial; font-size:11px; color:#333333;"><strong>Name</strong></td>
<td width="314" style="font-family:Verdana, Arial; font-size:11px; color:#333333;">'.$name.'</td>
</tr>
<tr bgcolor="#eeeeee">
<td style="font-family:Verdana, Arial; font-size:11px; color:#333333;"><strong>E-mail address:</strong></td>
<td style="font-family:Verdana, Arial; font-size:11px; color:#333333;">'.$email.'</td>
</tr>
<tr bgcolor="#eeeeee">
<td style="font-family:Verdana, Arial; font-size:11px; color:#333333;"><strong>Telephone number:</strong></td>
<td style="font-family:Verdana, Arial; font-size:11px; color:#333333;">'.$telephone.'</td>
</tr>
<tr bgcolor="#eeeeee">
<td style="font-family:Verdana, Arial; font-size:11px; color:#333333;"><strong>Company:</strong></td>
<td style="font-family:Verdana, Arial; font-size:11px; color:#333333;">'.$company.'</td>
</tr>
<tr bgcolor="#eeeeee">
<td style="font-family:Verdana, Arial; font-size:11px; color:#333333;"><strong>Address</strong></td>
<td style="font-family:Verdana, Arial; font-size:11px; color:#333333;">'.$address1.'</td>
</tr>
<tr bgcolor="#eeeeee">
<td></td>
<td style="font-family:Verdana, Arial; font-size:11px; color:#333333;">'.$address2.'</td>
</tr>
<tr bgcolor="#eeeeee">
<td style="font-family:Verdana, Arial; font-size:11px; color:#333333;"><strong>Town</strong></td>
<td style="font-family:Verdana, Arial; font-size:11px; color:#333333;">'.$town.'</td>
</tr>
<tr bgcolor="#eeeeee">
<td style="font-family:Verdana, Arial; font-size:11px; color:#333333;"><strong>County</strong></td>
<td style="font-family:Verdana, Arial; font-size:11px; color:#333333;">'.$county.'</td>
</tr>
<tr bgcolor="#eeeeee">
<td style="font-family:Verdana, Arial; font-size:11px; color:#333333;"><strong>Postcode</strong></td>
<td style="font-family:Verdana, Arial; font-size:11px; color:#333333;">'.$postcode.'</td>
</tr>
<tr bgcolor="#eeeeee">
<td colspan="2" style="font-family:Verdana, Arial; font-size:11px; color:#333333;"><strong>Message</strong></td>
</tr>
<tr bgcolor="#eeeeee">
<td colspan="2" style="font-family:Verdana, Arial; font-size:11px; color:#333333;">'.$message.'</td>
</tr>
<tr><td colspan="2" style="padding:0px;"><img src="images/whitespace.gif" alt="" width="100%" height="1" /></td></tr>
</table>
$url = stripslashes($_POST["url"]);
if (!empty($url)) {
header( 'Location: http://www.go-away-spam-robots.com' );
exit();
mail($to, $subject, $message, $headers);
header( 'Location: http://www.mydomain.com/sent.php' ) ;
?>
Any help on this would be greatly appreciated.
Thank you and I hope to hear from you!
SMRevised code with form validation for Name Email and Message:
<?php
if (array_key_exists('submit', $_POST)) {
$name = $_POST['name'];
$email = $_POST['email'];
$telephone = $_POST['telephone'];
$company = $_POST['company'];
$address1 = $_POST['address1'];
$address2 = $_POST['address2'];
$town = $_POST['town'];
$county = $_POST['county'];
$postcode = $_POST['postcode'];
$formMessage = $_POST['message'];
if (empty($name)) {
$warning['name'] = "Please provide your name";
if (empty($email)) {
$warning['email'] = "Please provide your email";
if (empty($formMessage)) {
$warning['message'] = "Please provide your message";
$headers .= "Reply-To: " . $_POST["email"] . "\r\n";
$to = "[email protected]";
$subject = "Contact from website";
$message = $headers;
$message .= "Name: " . $_POST["name"] . "\r\n";
$message .= "E-mail: " . $_POST["email"] . "\r\n";
$headers = "MIME-Version: 1.0\r\n";
$headers .= "Content-type: text/html; charset=iso-8859-1\r\n";
$message= "
<table cellspacing='0' cellpadding='8' border='0' width='500'>
<tr>
<td colspan='2'></td>
</tr>
<tr bgcolor='#eeeeee'>
<td width='154' style='font-family:Verdana, Arial; font-size:11px; color:#333333;'><strong>Name</strong></td>
<td width='314' style='font-family:Verdana, Arial; font-size:11px; color:#333333;'>".$name."</td>
</tr>
<tr bgcolor='#eeeeee'>
<td style='font-family:Verdana, Arial; font-size:11px; color:#333333;'><strong>E-mail address:</strong></td>
<td style='font-family:Verdana, Arial; font-size:11px; color:#333333;'>".$email."</td>
</tr>
<tr bgcolor='#eeeeee'>
<td style='font-family:Verdana, Arial; font-size:11px; color:#333333;'><strong>Telephone number:</strong></td>
<td style='font-family:Verdana, Arial; font-size:11px; color:#333333;'>".$telephone."</td>
</tr>
<tr bgcolor='#eeeeee'>
<td style='font-family:Verdana, Arial; font-size:11px; color:#333333;'><strong>Company:</strong></td>
<td style='font-family:Verdana, Arial; font-size:11px; color:#333333;'>".$company."</td>
</tr>
<tr bgcolor='#eeeeee'>
<td style='font-family:Verdana, Arial; font-size:11px; color:#333333;'><strong>Address</strong></td>
<td style='font-family:Verdana, Arial; font-size:11px; color:#333333;'>".$address1."</td>
</tr>
<tr bgcolor='#eeeeee'>
<td></td>
<td style='font-family:Verdana, Arial; font-size:11px; color:#333333;'>".$address2."</td>
</tr>
<tr bgcolor='#eeeeee'>
<td style='font-family:Verdana, Arial; font-size:11px; color:#333333;'><strong>Town</strong></td>
<td style='font-family:Verdana, Arial; font-size:11px; color:#333333;'>".$town."</td>
</tr>
<tr bgcolor='#eeeeee'>
<td style='font-family:Verdana, Arial; font-size:11px; color:#333333;'><strong>County</strong></td>
<td style='font-family:Verdana, Arial; font-size:11px; color:#333333;'>".$county."</td>
</tr>
<tr bgcolor='#eeeeee'>
<td style='font-family:Verdana, Arial; font-size:11px; color:#333333;'><strong>Postcode</strong></td>
<td style='font-family:Verdana, Arial; font-size:11px; color:#333333;'>".$postcode."</td>
</tr>
<tr bgcolor='#eeeeee'>
<td colspan='2' style='font-family:Verdana, Arial; font-size:11px; color:#333333;'><strong>Message</strong></td>
</tr>
<tr bgcolor='#eeeeee'>
<td colspan='2' style='font-family:Verdana, Arial; font-size:11px; color:#333333;'>".$formMessage."</td>
</tr>
<tr><td colspan='2' style='padding: 0px;'><img src='images/whitespace.gif' alt='' width='100%' height='1' /></td></tr>
</table>
$url = stripslashes($_POST["url"]);
if (!empty($url)) {
header( 'Location: http://www.go-away-spam-robots.com' );
exit();
if (!isset($warning)) {
mail($to, $subject, $message, $headers);
header( 'Location: http://www.mydomain.com/sent.php' ) ;
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Untitled Document</title>
<style type="text/css">
p {
margin: 0;
padding: 10px 0 0 0;
.warning {
color:#C00;
</style>
</head>
<body>
<form action="" method="post" name="contact" id="contact">
<p><strong>Name:*</strong><br />
<input name="name" <?php if (isset($warning['name'])) { echo "style='border: 1px solid #C00'"; } ?> type="text" class="ctextField" />
<?php if (isset($warning['name'])) { echo "<p class='warning'>".$warning['name']."</p>"; }?>
</p>
<p><strong>E-mail:*</strong><br />
<input name="email" <?php if (isset($warning['email'])) { echo "style='border: 1px solid #C00'"; } ?>type="text" class="ctextField" />
<?php if (isset($warning['name'])) { echo "<p class='warning'>".$warning['email']."</p>"; }?>
</p>
<p><strong>Telephone:</strong><br />
<input name="telephone" type="text" class="ctextField" /></p>
<p><strong>Company:</strong><br />
<input name="company" type="text" class="ctextField" /></p>
<p><strong>Address:</strong><br />
<input name="address1" type="text" class="ctextField" /></p>
<p><input name="address2" type="text" class="ctextField" /></p>
<p><strong>Town:</strong><br />
<input name="town" type="text" class="ctextField" /></p>
<p><strong>County:</strong><br />
<input name="county" type="text" class="ctextField" /></p>
<p><strong>Postcode:</strong><br />
<input name="postcode" type="text" class="ctextField" /></p>
<p><strong>Message:*</strong><br />
<?php if (isset($warning['message'])) { echo "<p class='warning'>".$warning['message']."</p>"; }?>
<textarea name="message" <?php if (isset($warning['message'])) { echo "style='border: 1px solid #C00'"; } ?> cols="55" rows="8" class="ctextField"></textarea></p>
<p><input name="submit" value="SEND MESSAGE" class="submitButton" type="submit" /><div style="visibility:hidden; width:1px; height:1px"><input name="url" type="text" size="45" id="url" /></div></p>
</form>
</body>
</html> -
I built a form in Dreamweaver CS4 which looks and seems to work fine both in IE and FF. I then wrote the PHP script and uploaded it to my hosting site. When I fill in the form on the web, I get my "thank you" email stating I will contact them in 24 - 48 hours. I also get this from the hosting site - This email was sent using the PHP mail() function. If you received this email than the PHP mailer is working fine. With all that said my problem is that I do not get a copy of the form details. On the properties section in Dreamweaver, I have the Form ID as contactus and Action connecting to my folder - ../Contactform.php, but I have the target blank. What would it be - blank, parent or self or should it just be black?
Thanks in advance for any help.target="_blank" opens a page in a new window. It is not used for forms processing.
For a form, when you begin it, you need to tell it what's going to happen:
<form method="post" action="Contactform.php">
(And, actually, I don't recommend the use of upper and lower-case characters in any file that is to be called by a web server, bu that is not related to your issue.)
Then, you will have an action button at the bottom of your form:
<input type="submit" value=" Contact Me" />
When that action button (or submit button) is activated on your web page, it should query the form for what to do. In the case that I'm outlining here, the action is to run the php file you have called Contactform.php.
At that point, your php code takes over and will do something.
In your php, do you have something like this?
$subject = Contact_from_your_webpage;
$notes = stripcslashes($notes);
$message = " $todayis [EST] \n
Message: $notes \n
From: $visitor ($visitormail)\n
Telephone: $visitorphone ($visitorphone)\n
From: $visitor ($visitormail)\n
Address: $address1 ($address1)\n
Address: $address2 ($address2)\n
From: $city $state $zip\n
$from = "From: $visitormail\r\n";
mail("[email protected]", $subject, $message, $from);
This should send you an email with all of the stuff you put in your form to send
Please understand that, in this case, I am using form fields that may be different from yours (you didn't provide us with a link, so I don't know what your form fields are). My fields are as follows:
visitor
visitormail
visitorphone
address1
address2
city
state
zip
notes
I am going to hazard a guess that, either you didn't tell your form to do the right thing or your php is wrong.
-Mark -
Problems with php script in the contact form
Hello, I am from the Czech Republic and I am not a coder. I have 2 problems with my php sript. I am using a simple php script from Paul Trani, see below.
Firstly the email adress - when someone inserts an email adress in this form [email protected] it is OK, but when someone writes an address for example [email protected] (this type of adress is very common in our country) the answer is "That is not a valid email address. Please return to the previous page and try again." I think the problem is the dot before the @.
Secondly diacritical marks - Since I am from the Czech Republic we use diacritical marks (for example š,č,ř,ž,á,í,é,ě) so instead of this letters a get ? or Å™ or Å¡ to my email.
I really do not know how to fix these problems.
Thank you for any help. Sorry for my English. Peter
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<META HTTP-EQUIV="refresh" content="0;URL=thankyou.html">
<title>Email Form</title>
</head>
<body>
<?php
$name=addslashes($_POST['name']);
$email=addslashes($_POST['email']);
$comments=addslashes($_POST['message']);
// you can specify which email you want your contact form to be emailed to here
$toemail = "[email protected]";
$subject = "From EcoStyleStudio.com";
$headers = "MIME-Version: 1.0\n"
."From: \"".$name."\" <".$email.">\n"
."Content-type: text/html; charset=iso-8859-1\n";
$body = "Name: ".$name."<br>\n"
."Email: ".$email."<br>\n"
."Comments:<br>\n"
.$comments;
if (!ereg("^[a-zA-Z0-9_]+@[a-zA-Z0-9\-]+\.[a-zA-Z0-9\-\.]+$", $email))
echo "That is not a valid email address. Please return to the"
." previous page and try again.";
exit;
mail($toemail, $subject, $body, $headers);
echo "Thanks for submitting your comments";
?>
</body>
</html>ereg() has been deprecated, it is recommended that you dont use it.
You want to look at this
http://www.php.net/manual/en/function.preg-match.php
Within this page I found this:
If you need to check for .com.br and .com.au and .uk and all the other crazy domain endings i found the following expression works well if you want to validate an email address. Its quite generous in what it will allow
<?php
$email_address = "phil.taylor@a_domain.tv";
if (preg_match("/^[^@]*@[^@]*\.[^@]*$/", $email_address)) {
return "E-mail address";
?> -
Running PHP script via ColdFusion
I'm running CFMX 7 on a Solaris platform with PHP 5.0.5.
I need to determine the width and height of an uploaded image
to ensure that the file can be reasonably used on a web page. I
have scoured the Internet and found a numer of solutions to this.
Most need the installation of additional software on our server and
the creation of a custom tag. These are doable, but would require
additional effort I don't have time for at the moment. Also, the
software to install is a full image manipulation package that is
definitely overkill for my needs. Kind of like threading a needle
with a hammer.
On the other hand I know that PHP has a command called
"getimagesize" that would be perfect for my use. This would be much
more simple and elegant. And I have created a small program (see
below) that can accept a location of an image file and display the
width and height of the image as a result. The code is:
<?php
list($width, $height) = getimagesize($argv[1]);
echo "$width, $height";
?>
I've tested it via the command line and it works fine.
However, I'm having difficulty in running it via the ColdFusion
cfexecute tag. Here is that code:
<cfsavecontent variable="imgsize">
<cfexecute name="#phpfilelocation#"
arguments="#imagelocation#"></cfexecute>
</cfsavecontent>
I get nothing back from this. I've also tried the cfhttp tag
with similar results. It seems to me that the argument (the
location of the image) is not being accepted by the PHP code for
some reason.
I've looked for a solution to this within this forum and via
Google, etc. to no avail. There is apparently something about PHP
or ColdFusion that is escaping me. Any help clarifying why this is
not working and (hopefully) a workaround would be very much
appreciated. Thank you.Maybe this will help:
http://groups.google.com/group/alt.comp.lang.coldfusion/msg/af84ac7dfec0d09e?dq=&hl=en&lr= &ie=UTF-8&oe=UTF-8&rnum=8 -
I need help with this script please ASAP
So I need this to work properly, but when ran and the correct answer is chosen the app quits but when the wrong answer is chosen the app goes on to the next question. I need help with this ASAP, it is due tommorow. Thank you so much for the help if you can.
The script (Sorry if it's a bit long):
#------------Startup-------------
display dialog "Social Studies Exchange Trviva Game by Justin Parzik" buttons {"Take the Quiz", "Cyaaaa"} default button 1
set Lolz to (button returned of the result)
if Lolz is "Cyaaaa" then
killapp()
else if Lolz is "Take the Quiz" then
do shell script "say -v samantha Ok starting in 3…2…1…GO!"
#------------Question 1-----------
display dialog "Around age 11, many boys left their fathers to become…" buttons {"Scholars", "Warriors", "Apprentices"}
set A1 to (button returned of the result)
if A1 is "Apprentices" then
do shell script "say -v samantha Correct Answer"
else
do shell script "say -v samantha Wrong Answer"
#----------Question 2--------
display dialog "Most children were taught
to read so that they could understand the…" buttons {"Music of Mozart", "Bible", "art of cooking"}
set A2 to (button returned of the result)
if A2 is "Bible" then
do shell script "say -v samantha Correct Answer"
else
do shell script "say -v samantha Wrong Answer"
#------------Question 3---------
display dialog "In the 1730s and 1740s, a religious movement called the_______swept through the colonies." buttons {"Glorius Revolution", "Great Awakening", "The Enlightenment"}
set A3 to (button returned of the result)
if A3 is "Great Awakening" then
do shell script "say -v samantha Correct Answer"
else
do shell script "say -v samantha Wrong Answer"
#-----------Question 4--------
display dialog "_______ was
a famous American Enlightenment figure." buttons {"Ben Franklin", "George Washington", "Jesus"}
set A4 to (button returned of the result)
if A4 is "Ben Franklin" then
do shell script "say -v samantha Correct Answer"
else
do shell script "say -v samantha Wrong Answer"
#----------Question 5-------
display dialog "______ ownership gave colonists political rights as well as prosperity." buttons {"Land", "Dog", "Slave"}
set A5 to (button returned of the result)
if A5 is "Land" then
do shell script "say -v samantha Correct Answer"
else
do shell script "say -v samantha Wrong Answer"
#---------Question 6--------
display dialog "The first step toward guaranteeing these rights came in 1215. That
year, a group of English noblemen forced King John to accept the…" buttons {"Declaration of Independence", "Magna Carta", "Constitution"}
set A6 to (button returned of the result)
if A6 is "Magna Carta" then
do shell script "say -v samantha Correct Answer"
else
do shell script "say -v samantha Wrong Answer"
#----------Question 7--------
display dialog "England's cheif lawmaking body was" buttons {"the Senate", "Parliament", "King George"}
set A7 to (button returned of the result)
if A7 is "Parliament" then
do shell script "say -v samantha Correct Answer"
else
do shell script "say -v samantha Wrong Answer"
#--------Question 8-----
display dialog "Pariliament decided to overthrow _______ for not respecting their rights" buttons {"King James II", "King George", "King Elizabeth"}
set A8 to (button returned of the result)
if A8 is "King James II" then
do shell script "say -v samantha Correct Answer"
else
do shell script "say -v samantha Wrong Answer"
#--------Question 9------
display dialog "Parliament named ___ and ___ as England's new monarchs in something called ____." buttons {"William/Mary/Glorius Revolution", "Adam/Eve/Great Awakening", "Johhny/Mr.Laphalm/Burning of the hand ceremony"}
set A9 to (button returned of the result)
if A9 is "William/Mary/Glorius Revolution" then
do shell script "say -v samantha Correct Answer"
else
do shell script "say -v samantha Wrong Answer"
#---------Question 10-----
display dialog "After accepting the throne William and Mary agreed in 1689 to uphold the English Bill of _____." buttons {"Money", "Colonies", "Rights"}
set A10 to (button returned of the result)
if A10 is "Rights" then
do shell script "say -v samantha Correct Answer"
else
do shell script "say -v samantha Wrong Answer"
#---------Question 11------
display dialog "By the late 1600s French explorers had claimed the ___ River Valey" buttons {"Mississippi", "Ohio", "Hudson"}
set A11 to (button returned of the result)
if A11 is "Ohio" then
do shell script "say -v samantha Correct Answer"
else
do shell script "say -v samantha Wrong Answer"
#------Question 12---------
display dialog "______ was sent to ask the French to leave 'English Land'." buttons {"Johhny Tremain", "George Washington", "Paul Revere"}
set A12 to (button returned of the result)
if A12 is "George Washington" then
do shell script "say -v samantha Correct Answer"
else
do shell script "say -v samantha Wrong Answer"
#---------Question 13-------
display dialog "_____ proposed the Albany Plan of Union" buttons {"George Washingon", "Ben Franklin", "John Hancock"}
set A13 to (button returned of the result)
if A13 is "Ben Franklin" then
do shell script "say -v samantha Correct Answer"
else
do shell script "say -v samantha Wrong Answer"
#--------Question 14------
display dialog "The __________ declared that England owned all of North America east of the Mississippi" buttons {"Proclomation of England", "Treaty of Paris", "Pontiac Treaty"}
set A14 to (button returned of the result)
if A14 is "" then
do shell script "say -v samantha Correct Answer"
else
do shell script "say -v samantha Wrong Answer"
#-------Question 15-------
display dialog "Braddock was sent to New England so he could ______" buttons {"Command an attack against French", "Scalp the French", "Kill the colonists"}
set A15 to (button returned of the result)
if A15 is "Command an attack against French" then
do shell script "say -v samantha Correct Answer"
else
do shell script "say -v samantha Wrong Answer"
#------TheLolQuestion-----
display dialog "____ is the name of the teacher who runs this class." buttons {"Mr.White", "Mr.John", "Paul Revere"} default button 1
set LOOL to (button returned of the result)
if LOOL is "Mr.White" then
do shell script "say -v samantha Congratulations…you…have…common…sense"
else
do shell script "say -v alex Do…you…have…eyes?"
#------END------
display dialog "I hope you enjoyed the quiz!" buttons {"I did!", "It was horrible"}
set endmenu to (button returned of the result)
if endmenu is "I did!" then
do shell script "say -v samantha Your awesome"
else
do shell script "say -v alex Go outside and run a lap"
end if
end if
end if
end if
end if
end if
end if
end if
end if
end if
end if
end if
end if
end if
end if
end if
end if
end ifUse code such as:
display dialog "Around age 11, many boys left their fathers to become…" buttons {"Scholars", "Warriors", "Apprentices"}
set A1 to (button returned of the result)
if A1 is "Apprentices" then
do shell script "say -v samantha Correct Answer"
else
do shell script "say -v samantha Wrong Answer"
return
end if
#----------Question 2--------
display dialog "Most children were taught to read so that they could understand the…" buttons {"Music of Mozart", "Bible", "art of cooking"}
set A2 to (button returned of the result)
if A2 is "Bible" then
do shell script "say -v samantha Correct Answer"
else
do shell script "say -v samantha Wrong Answer"
return
end if
(90444) -
Hi guys,
Thanks for the interest in my post...
I want to make a gallery similar to the one at
http://www.danwheldon.com/gallery.cfm
where the user clicks on an image and it refreshes the current page
bringing up the enlarged version above the rest of the thumbnails.
I've made a .php page and linked the thumbnails like
main.php?pagename=gallery&image=01. The only thing I think I
need is to insert a php script where I will want the enlarged image
to appear.
Can anyone help me on this by any chance? I found the
following script but don't know how to edit it to do what I need:
<img src="images/<?php echo $imgNo; ?>.jpg"
title="Image <?php echo $imgName; ?>" />
Thank you very much and I hope to hear from you.
All the best,
MarkSpindrift wrote:
> I've made a .php page and linked the thumbnails like
> main.php?pagename=gallery&image=01. The only thing I
think I need is to insert
> a php script where I will want the enlarged image to
appear.
>
> Can anyone help me on this by any chance? I found the
following script but
> don't know how to edit it to do what I need:
>
> <img src="images/<?php echo $imgNo; ?>.jpg"
title="Image <?php echo $imgName;
> ?>" />
<img src="images/<?php echo $_GET['image']; ?>.jpg"
/>
David Powers
Author, "Foundation PHP for Dreamweaver 8" (friends of ED)
Author, "Foundation PHP 5 for Flash" (friends of ED)
http://foundationphp.com/ -
Problem uploading images with php script.
As a webdebdesigner i developped a cms system to upload images with php to a mysql database. Firefox version 5.0.1 for MAC and earlier have no problems with uploading through the script. But after that version it is impossible to upload images bigger then 250kb. The page where the customer chooses his image for upload stalls and the form is not sent to the actual upload script, which should validate and process the image.
This problem only occurs in Firefox, all other browsers work just fine!
On top of that: Giving feedback to firefox not possible for MAC.Try posting at the Web Development / Standards Evangelism forum at MozillaZine. The helpers over there are more knowledgeable about web site development issues with Firefox. <br />
http://forums.mozillazine.org/viewforum.php?f=25 <br />
You'll need to register and login to be able to post in that forum. -
Hi,
I found this Apple script online and here's how it works:
tell application "QuickTime Player"
activate
try
if not (exists document 1) then display dialog "Please open a QuickTime movie." buttons {"Cancel"} default button 1 with icon 1
set thefile to (choose file name)
save document 1 in thefile
close document 1
end try
end tell
+I run the Apple script+
*1. It prompts me to open a movie file in Quicktime*
+I open a movie in Quicktime+
*2. It prompts me for an name and directory to save the new file in*
+I enter a name and directory+
*3. It saves a new reference movie in said directory with said name*
This is useful if I want to customize every file, but unfortunately, I just want to mass create reference movies for a whole bunch of files.
What I am looking for is for an Apple script that is a drag and drop application, so I can drop say 100 movie files or so, and have the Apple script create reference movie files with the same name and in the same directory automatically with no prompts.
Since I am unfamiliar with Apple script I was wondering if someone would be able to edit my existing script to do what I want.
Thanks so much for your help!Use Automator. It's great for repetitious tasks (like the one you've described), and it's very user-friendly. Open Automator, create a new workflow that executes the action you want, and you can apply that action to the resources you wish to edit.
Good resource here:
http://bit.ly/
Maybe you are looking for
-
How to disappear the search help in alv
hi experts: some field's search help in alv appear automaticly,such as bukrs. I want to disappear the search help in ALV.how it come true? the alv is CL_GUI_ALV_GRID. Edited by: huiqing wei on Apr 20, 2009 10:35 AM
-
Can anyone tell me how to install a network printer driver without having the network printer online? It doesn't matter what manufactors make the network printers. Is a netwaork printer(with network card) has to have that printer on line to be able t
-
Why is the screen on my black iPhone so much better than my white one?
the white's screen is washed out and the black has more contrast and is brighter
-
MSS 60.2 compatibility with system
Currently we are running ECC6 EhP3 with NW 7 (EP) and ESS 50.4. Can we deploy MSS 60.2 and it will work or do the ESS and MSS versions have to be the same? Thank you for your assistance. D. Maupin University of Kentucky
-
Why won't my copy of Filemaker Pro 9 work on my new Mac Pro [10.9.4]?