Form Question

They have: 344 posts

Joined: Jun 2002

Hi guys!

I am currently re-designing my site and I have created a form but when tested it doesn't go to my inbox...do you have any idea why???

The URL for the form is:

[URL=http://cmdirector.neosurge.net/stories.shtml ]Form[/URL]

The code for the form is below:

Your Name

Your E-Mail (needs to be valid)

Story Category

CM 01/02
CM 4
The Weird World of CM
My Cup Glory
The Dizzy Heights of Relegation

Story Title

Your Story

 

I hope you guys can help!

nike_guy_man's picture

They have: 840 posts

Joined: Sep 2000

Take out the first
That seems to be messing it up

They have: 344 posts

Joined: Jun 2002

Right...that seems to work but it uses the user's browser...is there another way of doing this???

They have: 344 posts

Joined: Jun 2002

Can you test it for me???

What would the title of the e-mail be??? Do I have to put that into the blank space just next to submit???

nike_guy_man's picture

They have: 840 posts

Joined: Sep 2000

What are you trying to do here?
Are you trying to have it open up the user's email program to send it?
If you want it to go through the browser and send to your email, you should use a server-side script in PHP or PERL... There are many already written that you'd just have to upload to your site
If you are trying to have it open in the user's email program, use a link, like

<a href="mailto:[email protected]?Subject=Subject">
'

Laughing out loud

The Webmistress's picture

She has: 5,586 posts

Joined: Feb 2001

The best thing to so is first check whether your host has a premade script you can use to handle the form and if so they'll give the path to put in the form action to process it. Alternatively you will have to use a script to process the form, as nike said, using a server-side script. See what the hosting company says and then report back here.

Julia - if life was meant to be easy Michael Angelo would have painted the floor....

Busy's picture

He has: 6,151 posts

Joined: May 2001

add enctype="text/plain" into the form tag and use the subject section
nike_guy_man mentioned and it should send you all the details of the form to you.
if you use similar forms for different topics, add a hidden input for the form title, like so:

They have: 344 posts

Joined: Jun 2002

no pre-made script but they told me to get one from HotScripts.com

They have: 344 posts

Joined: Jun 2002

I haven't but wonder if you guys can recommend one...

Busy's picture

He has: 6,151 posts

Joined: May 2001

are you able to use PHP or ASP etc?

The Webmistress's picture

She has: 5,586 posts

Joined: Feb 2001

If you can't use php or asp then see if you can install a cgi-script and the most common one is from Matt's Script Archive which you download, modify and upload to your cgi-bin. I believe php or asp are more secure though.

Julia - if life was meant to be easy Michael Angelo would have painted the floor....

They have: 344 posts

Joined: Jun 2002

Yes my host supports PHP so can i have a Php script and how do I use it???

The Webmistress's picture

She has: 5,586 posts

Joined: Feb 2001

Do you know anything about php? Often it isn't just a case of using a script, you have to know how to amend it for your purposes and integrate it into your site. Here are a couple of pre-made ones I found on google:

http://php.resourceindex.com/Complete_Scripts/Form_Processing
http://www.cluxa.com/products/afh/doc/index.shtml

Julia - if life was meant to be easy Michael Angelo would have painted the floor....

They have: 344 posts

Joined: Jun 2002

No I haven't a clue

They have: 344 posts

Joined: Jun 2002

I have been told to place this in my first row:

<form action="mailto:[email protected]" method="POST" enctype="text/plain"> '

That won't give me a subject title will it???

The Webmistress's picture

She has: 5,586 posts

Joined: Feb 2001

If you want the subject line to be entered automatically change the code to this:<form action="mailto:[email protected]?subject=Whatever" method="POST" enctype="text/plain">'

Julia - if life was meant to be easy Michael Angelo would have painted the floor....

They have: 344 posts

Joined: Jun 2002

Thanks for that!

I have added the line but so far I have not recieved any e-mail from someone I asked to test it. Should the e-mail arrive straight away?

Jack Michaelson's picture

He has: 1,733 posts

Joined: Dec 1999

Yes that email should arrive pretty straight away...

But you could test it yourself, or post the address of the site here so that some of us can help you by testing it Smiling.

Shakespeare: onclick || !(onclick)

Suzanne's picture

She has: 5,507 posts

Joined: Feb 2000

The other issues that you'll have using mailto: in the action attribute of a form are:

1. Your+data+will+look+like+this.
2. It's not secure and generates an alert message to the user that you cannot disable telling them this is a very very very insecure method.

It's better to learn how to do this properly (server-side script) than to bother learning how to do it with mailto:, really.

They have: 344 posts

Joined: Jun 2002

Ok...but I do not know php. Is it easy to pick up and there are thousands of these form scripts. How do I know which one to choose?

Suzanne's picture

She has: 5,507 posts

Joined: Feb 2000

Good questions. If you're not familiar with server-side languages, or programming in general, I wouldn't say that PHP is easy to pick up. However, the mail application is very easy in PHP if you don't want form validation (which you should want).

If you're going to try to build it yourself, post in the Server-Side forum, otherwise, check out the ones that are available, test them (to see if they do what you want).

You will have to do this sooner or later, so take this opportunity to start figuring things out for yourself by testing the scripts, and reading up on what should be included in a form processor (try Google or AllTheWeb for pages related to this). You don't need to learn how to script it yourself, but you should be able to determine what features you need.

They have: 344 posts

Joined: Jun 2002

ok..thanks for your help!

I will go try that!

Suzanne's picture

She has: 5,507 posts

Joined: Feb 2000

If you run into problems with installation, or really get horribly stuck, the Server-Side forum is the place to go for help. Good luck! Smiling

They have: 344 posts

Joined: Jun 2002

I have decided to use this script:

Form Processor

What do you reckon about it? Is it ok?

They have: 344 posts

Joined: Jun 2002

A bit of a stumper has cropped up! I don't know where exactly to stop adding my HTML and where to put "THE CODE".

Hope you can help!

Here is the page which I want to put the code in. Stories Page

The code of the page is:

<html>
<head>
<title></title>
</head>
<body>
<?php
// EDIT FROM HERE ONWARDS
// Your name. e.g. $y_name = "Alicia";
$y_name = "";

// Your email. e.g. $y_email = "alicia@some_email.com";
$y_email = "";

// Auto response option - yes or no. e.g. $autor = "yes";
$autor = "";

/* Message for auto response mail. e.g. $autor_mail = "Thanks for filling up the form at my site. I will get back to you shortly"; If you don't want auto response ignore this */
$autor_mail = "";

/* Subject of the Autoresponse Mail. e.g. $autor_subject = "Auto Response Email"; */
$autor_subject = "";

/* The URL the form will redirect to after processing the email form. e.g. $after = "thanks.html"; */
$after = "";

/* The required fields for the form. e.g. $rfields = "name,email,message"; separate fields with a comma. the fields are what that is found in:
<input type="text" name="email">
the name part. in this case, it is email. another example.
<input type="text" name="bla">
so in this case it is bla. if you don't want any required fields, just leave this thing blank(default)*/
$rfields = "name,email";
// DO NOT EDIT ANY FURTHER PLEASE.

if (isset($sent)) {
if (!
$rfields == "") {
$rfields = explode(",", $rfields);

for(
$i = 0; $i < count($rfields); $i++) {
if ($
$rfields[$i] == "") {
echo
"You have not filled up the required field <b>$rfields[$i]</b>. Please click <a href=\"javascript:history.back(1)\">here</a> to go back and fill up the required field. Thank You.";
exit;
}
}
}
if (!
ereg('^[-!#$%&\'*+\\./0-9=?A-Z^_`a-z{|}~]+'.

'@'.

'[-!#$%&\'*+\\/0-9=?A-Z^_`a-z{|}~]+\.'.

'[-!#$%&\'*+\\./0-9=?A-Z^_`a-z{|}~]+$', $email)) {
echo
"Your email, $email, is not valid. Please click <a href=\"javascript:history.back(1)\">here</a> to fill in a proper email. Thank You.";
exit;
}


$fmail = "$y_name, you have received an email form. The following contains the information.\n\n";
$fmail.= "IP Address: $REMOTE_ADDR\n";

$fields = array_keys($HTTP_POST_VARS);
for(
$i = 0; $i < count($fields); $i++) {
   
$temp = $fields[$i];
    if (
$temp == "rfields" || $temp == "submit" || $temp == "sent" || $temp == "y_name" || $temp == "y_email" || $temp == "autor" || $temp == "autor_message" || $temp == "$autor_mail" || $temp == "$autor_subject" || $temp == "after")
       
$fmail = $fmail;
    else {
       
$temp1 = stripslashes($HTTP_POST_VARS[$temp]);
       
$fmail.= "$temp: $temp1\n";
    }
}
$fmail.= "\nThank you for using CesMailForm(<a href="http://wonderful.frenzied.org" class="bb-url">http://wonderful.frenzied.org</a>)";
$mailed = mail($y_email, "Email Form", $fmail, "Wrom: JEXXIMQZUIVOTQNQE
if (
$autor == "yes")
{
       
$autor_subject = stripslashes($autor_subject);
       
$autor_mail = stripslashes($autor_mail);
        mail(
$email, $autor_subject, $autor_mail, "Wrom: MSFDULHPQQWOYIYZUNNYC

}
if(!
$mailed) {
echo
"There is something wrong with the script or the configuration. How about emailing <a href=\"mailto:$y_email\">the site owner</a>?";
}
echo
"<meta HTTP-EQUIV=\"REFRESH\" content=\"0; url=$after\">";
   
} else {
?>


<form action="<? echo ($_SERVER['PHP_SELF']); ?>" method="post">
<!-- FORM. EDIT THE FORM. PLEASE USE PROPER HTML. -->
Name: <input type="text" name="name"><br><br>
Email: <input type="text" name="email"><br><br>
Message: <textarea rows="4" name="message"></textarea><br><br>
<input type="submit" name="submit" value="Submit">
<!-- DO NOT EDIT -->
<input type="hidden" name="sent" value="yes">
</form>

<?
}
?>
<!-- FREE TO EDIT AGAIN -->
</body>
</html>
'

So hope you can help!Smiling

Busy's picture

He has: 6,151 posts

Joined: May 2001

place the above code where you want the form to go
(the bottom bit of the code is the visible bit)

dont add anything above <?php or anything below

Suzanne's picture

She has: 5,507 posts

Joined: Feb 2000

You don't know how to put your code around that code? Is that the problem?

Edit: whoops, busy scooped me again. Wink

They have: 344 posts

Joined: Jun 2002

yeah that is the problem!

Suzanne's picture

She has: 5,507 posts

Joined: Feb 2000

Put this where you want the form:

<?php
// EDIT FROM HERE ONWARDS
// Your name. e.g. $y_name = "Alicia";
$y_name = "";

// Your email. e.g. $y_email = "alicia@some_email.com";
$y_email = "";

// Auto response option - yes or no. e.g. $autor = "yes";
$autor = "";

/* Message for auto response mail. e.g. $autor_mail = "Thanks for filling up the form at my site. I will get back to you shortly"; If you don't want auto response ignore this */
$autor_mail = "";

/* Subject of the Autoresponse Mail. e.g. $autor_subject = "Auto Response Email"; */
$autor_subject = "";

/* The URL the form will redirect to after processing the email form. e.g. $after = "thanks.html"; */
$after = "";

/* The required fields for the form. e.g. $rfields = "name,email,message"; separate fields with a comma. the fields are what that is found in:
<input type="text" name="email">
the name part. in this case, it is email. another example.
<input type="text" name="bla">
so in this case it is bla. if you don't want any required fields, just leave this thing blank(default)*/
$rfields = "name,email";
// DO NOT EDIT ANY FURTHER PLEASE.

if (isset($sent)) {
if (!
$rfields == "") {
$rfields = explode(",", $rfields);

for(
$i = 0; $i < count($rfields); $i++) {
if ($
$rfields[$i] == "") {
echo
"You have not filled up the required field <b>$rfields[$i]</b>. Please click <a href=\"java script:history.back(1)\">here</a> to go back and fill up the required field. Thank You.";
exit;
}
}
}
if (!
ereg('^[-!#$%&'*+\\./0-9=?A-Z^_`a-z{|}~]+'.

'@'.

'[-!#$%&'*+\\/0-9=?A-Z^_
`a-z{|}~]+\.'.

'
[-!#$%&'*+\\./0-9=?A-Z^_`a-z{|}~]+$', $email)) {
echo "Your email, $email, is not valid. Please click <a href=\"java script:history.back(1)\">here</a> to fill in a proper email. Thank You.";
exit;
}


$fmail = "$y_name, you have received an email form. The following contains the information.\n\n";
$fmail.= "IP Address: $REMOTE_ADDR\n";

$fields = array_keys($HTTP_POST_VARS);
for(
$i = 0; $i < count($fields); $i++) {
   
$temp = $fields[$i];
    if (
$temp == "rfields" || $temp == "submit" || $temp == "sent" || $temp == "y_name" || $temp == "y_email" || $temp == "autor" || $temp == "autor_message" || $temp == "$autor_mail" || $temp == "$autor_subject" || $temp == "after")
       
$fmail = $fmail;
    else {
       
$temp1 = stripslashes($HTTP_POST_VARS[$temp]);
       
$fmail.= "$temp: $temp1\n";
    }
}
$fmail.= "\nThank you for using CesMailForm(<a href="http://wonderful.frenzied.org" class="bb-url">http://wonderful.frenzied.org</a>)";
$mailed = mail($y_email, "Email Form", $fmail, "Wrom: JEXXIMQZUIVOTQNQE
if (
$autor == "yes")
{
       
$autor_subject = stripslashes($autor_subject);
       
$autor_mail = stripslashes($autor_mail);
        mail(
$email, $autor_subject, $autor_mail, "Wrom: MSFDULHPQQWOYIYZUNNYC

}
if(!
$mailed) {
echo
"There is something wrong with the script or the configuration. How about emailing <a href=\"mailto:$y_email\">the site owner</a>?";
}
echo
"<meta HTTP-EQUIV=\"REFRESH\" content=\"0; url=$after\">";
   
} else {
?>


<form action="<? echo ($_SERVER['PHP_SELF']); ?>" method="post">
<!-- FORM. EDIT THE FORM. PLEASE USE PROPER HTML. -->
Name: <input type="text" name="name"><br><br>
Email: <input type="text" name="email"><br><br>
Message: <textarea rows="4" name="message"></textarea><br><br>
<input type="submit" name="submit" value="Submit">
<!-- DO NOT EDIT -->
<input type="hidden" name="sent" value="yes">
</form>

<?
}
?>
<!-- FREE TO EDIT AGAIN -->
'

They have: 344 posts

Joined: Jun 2002

So that overwrites my original form code does it? Well how do I encorporate my form into that? Or have I misread you?

Suzanne's picture

She has: 5,507 posts

Joined: Feb 2000

Okey, dude, where the tags are in the sample above, put your own , et cetera tags. Just don't change anything where it says DO NOT EDIT.

They have: 344 posts

Joined: Jun 2002

Does it matter if the code is a mixture of HTML and the form is php?

They have: 344 posts

Joined: Jun 2002

This is the bit of forum code! I haven't uploaded it yet but I would like you to look at it first:

/* The required fields for the form. e.g. $rfields = "Name,E-Mail,Category,Story Title,Your Story"; separate fields with a comma. the fields are what that is found in:
<input type="text" name="name">
the name part. in this case, it is email. another example.
<input type="text" name="email">
<SELECT NAME="category" SIZE=2 MULTIPLE>
<OPTION SELECTED> CM 01/02
<OPTION> CM 4
<OPTION> The Weird World of CM
<OPTION> My Cup Glory
<OPTION> The Dizzy Heights of Relegation
</SELECT>
<input type="text" name="name" size="15">
<textarea name="comment" cols="25" rows="8"></textarea>
so in this case it is bla. if you don't want any required fields, just leave this thing blank(default)*/
$rfields = "name,email";
// DO NOT EDIT ANY FURTHER PLEASE.
'

Suzanne's picture

She has: 5,507 posts

Joined: Feb 2000

You can't have two fields called name.

/* The required fields for the form. e.g. $rfields = "Name,E-Mail,Category,Story Title,Your Story"; separate fields with a comma. the fields are what that is found in:

the name part. in this case, it is email. another example.
*/

CM 01/02
CM 4
The Weird World of CM
My Cup Glory
The Dizzy Heights of Relegation

/* so in this case it is bla. if you don't want any required fields, just leave this thing blank(default)*/
$rfields = "category,name,comment";
// DO NOT EDIT ANY FURTHER PLEASE.

Okay, you need to learn how to read the code.

Everything that is in italics is a PHP comment. It's not part of the PHP code, and not part of the HTML, it's just notes to you.

Everything that is in bold is PHP that you need to edit.

Everything else is HTML.

However, where are the <? ?> parts? PHP should always be enclosed within the document in the opening <? bracket and the ?> closing bracket.

They have: 344 posts

Joined: Jun 2002

That is the code with your changes:

Should I just cut and paste my old form code and put the relevant required fields in the place?

<?php
// EDIT FROM HERE ONWARDS
// Your name. e.g. $y_name = "Rob";
$y_name = "";

// Your email. e.g. $y_email = "[email protected]";
$y_email = "";

// Auto response option - yes or no. e.g. $autor = "yes";
$autor = "";

/* Message for auto response mail. e.g. $autor_mail = "Thank You for submitting a story!  I hope to enjoy reading it and I will get back to you telling you when it is on the site!"; If you don't want auto response ignore this */
$autor_mail = "";

/* Subject of the Autoresponse Mail. e.g. $autor_subject = "Story Form Reply"; */
$autor_subject = "";

/* The URL the form will redirect to after processing the email form. e.g. $after = "http://cmdirector.neosurge.net/stories.shtml"; */
$after = "";


<
SELECT NAME="category" SIZE=2 MULTIPLE>
<
OPTION SELECTED> CM 01/02
<OPTION> CM 4
<OPTION> The Weird World of CM
<OPTION> My Cup Glory
<OPTION> The Dizzy Heights of Relegation
</SELECT>
<
input type="text" name="name" size="15">
<
textarea name="comment" cols="25" rows="8"></textarea>
$rfields = "category,name,comment";
// DO NOT EDIT ANY FURTHER PLEASE.

if (isset($sent)) {
if (!
$rfields == "") {
$rfields = explode(",", $rfields);

for(
$i = 0; $i < count($rfields); $i++) {
if ($
$rfields[$i] == "") {
echo
"You have not filled up the required field <b>$rfields[$i]</b>. Please click <a href=\"java script:history.back(1)\">here</a> to go back and fill up the required field. Thank You.";
exit;
}
}
}
if (!
ereg('^[-!#$%&'*+\\./0-9=?A-Z^_`a-z{|}~]+'.

'@'.

'[-!#$%&'*+\\/0-9=?A-Z^_
`a-z{|}~]+\.'.

'
[-!#$%&'*+\\./0-9=?A-Z^_`a-z{|}~]+$', $email)) {
echo "Your email, $email, is not valid. Please click <a href=\"java script:history.back(1)\">here</a> to fill in a proper email. Thank You.";
exit;
}


$fmail = "$y_name, you have received an email form. The following contains the information.\n\n";
$fmail.= "IP Address: $REMOTE_ADDR\n";

$fields = array_keys($HTTP_POST_VARS);
for(
$i = 0; $i < count($fields); $i++) {
   
$temp = $fields[$i];
    if (
$temp == "rfields" || $temp == "submit" || $temp == "sent" || $temp == "y_name" || $temp == "y_email" || $temp == "autor" || $temp == "autor_message" || $temp == "$autor_mail" || $temp == "$autor_subject" || $temp == "after")
       
$fmail = $fmail;
    else {
       
$temp1 = stripslashes($HTTP_POST_VARS[$temp]);
       
$fmail.= "$temp: $temp1\n";
    }
}
$fmail.= "\nThank you for using CesMailForm(<a href="http://wonderful.frenzied.org" class="bb-url">http://wonderful.frenzied.org</a>)";
$mailed = mail($y_email, "Email Form", $fmail, "Wrom: JEXXIMQZUIVOTQNQE
if (
$autor == "yes")
{
       
$autor_subject = stripslashes($autor_subject);
       
$autor_mail = stripslashes($autor_mail);
        mail(
$email, $autor_subject, $autor_mail, "Wrom: MSFDULHPQQWOYIYZUNNYC

}
if(!
$mailed) {
echo
"There is something wrong with the script or the configuration. How about emailing <a href=\"mailto:$y_email\">the site owner</a>?";
}
echo
"<meta HTTP-EQUIV=\"REFRESH\" content=\"0; url=$after\">";
   
} else {
?>


<form action="<? echo ($_SERVER['PHP_SELF']); ?>" method="post">
<!-- FORM. EDIT THE FORM. PLEASE USE PROPER HTML. -->
Name: <input type="text" name="name"><br><br>
Email: <input type="text" name="email"><br><br>
Message: <textarea rows="4" name="message"></textarea><br><br>
<input type="submit" name="submit" value="Submit">
<!-- DO NOT EDIT -->
<input type="hidden" name="sent" value="yes">
</form>

<?
}
?>
<!-- FREE TO EDIT AGAIN -->
'

Suzanne's picture

She has: 5,507 posts

Joined: Feb 2000

Timewell, you need to learn how to read what goes where... Why are you not paying attention to the very clear instructions in the code?

Here's the corrected code:

<?php
// EDIT FROM HERE ONWARDS
// Your name. e.g. $y_name = "Rob";
$y_name = "<strong>PUT YOUR NAME HERE!</strong>";

// Your email. e.g. $y_email = "[email protected]";
$y_email = "<strong>PUT YOUR EMAIL HERE!</strong>";

// Auto response option - yes or no. e.g. $autor = "yes";
$autor = "<strong>PUT YOUR CHOICE HERE!</strong>";

/* Message for auto response mail. e.g. $autor_mail = "Thank You for submitting a story!  I hope to enjoy reading it and I will get back to you telling you when it is on the site!"; If you don't want auto response ignore this */
$autor_mail = "<strong>PUT YOUR MESSAGE HERE!</strong>";

/* Subject of the Autoresponse Mail. e.g. $autor_subject = "Story Form Reply"; */
$autor_subject = "<strong>PUT YOUR SUBJECT HERE!</strong>";

/* The URL the form will redirect to after processing the email form. e.g. $after = "http://cmdirector.neosurge.net/stories.shtml"; */
$after = "<strong>PUT YOUR URL HERE!</strong>";

<
strong>REMOVED YOUR FORM FIELDS FROM THIS SECTION</strong>
$rfields = "category,name,comment";
// DO NOT EDIT ANY FURTHER PLEASE.

if (isset($sent)) {
if (!
$rfields == "") {
$rfields = explode(",", $rfields);

for(
$i = 0; $i < count($rfields); $i++) {
if ($
$rfields[$i] == "") {
echo
"You have not filled up the required field <b>$rfields[$i]</b>. Please click <a href=\"java script:history.back(1)\">here</a> to go back and fill up the required field. Thank You.";
exit;
}
}
}
if (!
ereg('^[-!#$%&'*+\\./0-9=?A-Z^_`a-z{|}~]+'.

'@'.

'[-!#$%&'*+\\/0-9=?A-Z^_
`a-z{|}~]+\.'.

'
[-!#$%&'*+\\./0-9=?A-Z^_`a-z{|}~]+$', $email)) {
echo "Your email, $email, is not valid. Please click <a href=\"java script:history.back(1)\">here</a> to fill in a proper email. Thank You.";
exit;
}


$fmail = "$y_name, you have received an email form. The following contains the information.\n\n";
$fmail.= "IP Address: $REMOTE_ADDR\n";

$fields = array_keys($HTTP_POST_VARS);
for(
$i = 0; $i < count($fields); $i++) {
   
$temp = $fields[$i];
    if (
$temp == "rfields" || $temp == "submit" || $temp == "sent" || $temp == "y_name" || $temp == "y_email" || $temp == "autor" || $temp == "autor_message" || $temp == "$autor_mail" || $temp == "$autor_subject" || $temp == "after")
       
$fmail = $fmail;
    else {
       
$temp1 = stripslashes($HTTP_POST_VARS[$temp]);
       
$fmail.= "$temp: $temp1\n";
    }
}
$fmail.= "\nThank you for using CesMailForm(<a href="http://wonderful.frenzied.org" class="bb-url">http://wonderful.frenzied.org</a>)";
$mailed = mail($y_email, "Email Form", $fmail, "Wrom: JEXXIMQZUIVOTQNQE
if (
$autor == "yes")
{
       
$autor_subject = stripslashes($autor_subject);
       
$autor_mail = stripslashes($autor_mail);
        mail(
$email, $autor_subject, $autor_mail, "Wrom: MSFDULHPQQWOYIYZUNNYC

}
if(!
$mailed) {
echo
"There is something wrong with the script or the configuration. How about emailing <a href=\"mailto:$y_email\">the site owner</a>?";
}
echo
"<meta HTTP-EQUIV=\"REFRESH\" content=\"0; url=$after\">";
   
} else {
?>

" method="post">

THIS IS WHERE THE FORM FIELDS GO -- IN THE FORM!

CM 01/02
CM 4
The Weird World of CM
My Cup Glory
The Dizzy Heights of Relegation

SEE?

<?
}
?>

They have: 344 posts

Joined: Jun 2002

oops! I didn't see that!Sad

They have: 344 posts

Joined: Jun 2002

Well I got most of the form working apart from getting a load of rubbish when I upload it:

What have I done wrong now? *Don't shout at me :(*

Suzanne's picture

She has: 5,507 posts

Joined: Feb 2000

Apparently! Smiling

Here's a quick run down on commenting:

/* this is a comment for php, css and a number of other languages (C-style) and is used to comment out multiple lines of notes */

// this is a one line comment
// it's good for JavaScript, PHP
// it ends when you hit "enter" on your keyboard

# this is a one line comment for Perl (et cetera)

So, then, anything within a comment cannot be used by the processor. In order for it to work, variables and their values need to be outside of the comments.

Does that help?

Suzanne's picture

She has: 5,507 posts

Joined: Feb 2000

Wow, well apparently the code is leaking through instead of being processed. You do know that the page has to be .php or .php3 (on older servers) in order to be parsed?

Suzanne's picture

She has: 5,507 posts

Joined: Feb 2000

Quote: Originally posted by Timewell
*Don't shout at me :(*

Lol, sorry. I wasn't trying to shout at you, just make it really really really clear where you should be editing. Smiling

They have: 344 posts

Joined: Jun 2002

I renamed it to stories.php and got 3 errors:

Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /home/virtual/site21/fst/var/www/html/stories.php on line 139

Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /home/virtual/site21/fst/var/www/html/stories.php on line 139

Parse error: parse error, unexpected '.' in /home/virtual/site21/fst/var/www/html/stories.php on line 139

Suzanne's picture

She has: 5,507 posts

Joined: Feb 2000

Okay, good! Now you need to go to those lines and see what the problem is. I can't see that, so you'll have to either save the file as stories.phps (as well as the stories.php) so I can view the source code (Mark, does you viewer work on other people's source code?) or tell me what's on the line 139...

They have: 344 posts

Joined: Jun 2002

This is the code on Line 139:

if (!ereg('^[-!#$%&'*+\\./0-9=?A-Z^_`a-z{|}~]+'.

Suzanne's picture

She has: 5,507 posts

Joined: Feb 2000

That's only part of a line. Where's the rest of it? An if statement needs to end like this (in this case):

)) {

They have: 344 posts

Joined: Jun 2002

Nope that is the whole of the line.

Suzanne's picture

She has: 5,507 posts

Joined: Feb 2000

Well that's wrong, lol. It can't end there.

Save the file as stories.phps and put the url here and I'll take a look and see if I can find the problem.

They have: 344 posts

Joined: Jun 2002

Suzanne's picture

She has: 5,507 posts

Joined: Feb 2000

Okay, here's the whole problem area. I haven't checked the syntax, please post i the scripting forum for that.

if (!ereg('^[-!#$%&\'*+\\./0-9=?A-Z^_`a-z{|}~]+'.'@'.'[-!#$%&\'*+\\/0-9=?A-Z^_`a-z{|}~]+\.'.'[-!#$%&\'*+\\./0-9=?A-Z^_`a-z{|}~]+$', $email)) {
echo "Your email, $email, is not valid. Please click <a href=\"java script:history.back(1)\">here</a> to fill in a proper email. Thank You.";
exit;
}


$fmail = "$y_name, you have received an email form. The following contains the information.\n\n";
$fmail.= "IP Address: $REMOTE_ADDR\n";

$fields = array_keys($HTTP_POST_VARS);
for($i = 0; $i < count($fields); $i++) {
$temp = $fields[$i];
if ($temp == "rfields" || $temp == "submit" || $temp == "sent" || $temp == "y_name" || $temp == "y_email" || $temp == "autor" || $temp == "autor_message" || $temp == "$autor_mail" || $temp == "$autor_subject" || $temp == "after")
$fmail = $fmail;
else {
$temp1 = stripslashes($HTTP_POST_VARS[$temp]);
$fmail.= "$temp: $temp1\n";
}
}
$fmail.= "\nThank you for using CesMailForm(<a href="http://wonderful.frenzied.org" class="bb-url">http://wonderful.frenzied.org</a>)";
$mailed = mail($y_email, "Email Form", $fmail, "Wrom: JEXXIMQZUIVOTQNQE");
if ($autor == "yes")
{
$autor_subject = stripslashes($autor_subject);
$autor_mail = stripslashes($autor_mail);
mail($email, $autor_subject, $autor_mail, "Wrom: MSFDULHPQQWOYIYZUNNYC");

}
'

Lines 139 - 166

The lines with the Wrom parts in them (um? is that in the original script) were not terminated properly (missing "); at the ends), and the line 139 had a whole raft of unescaped ' and was on multiple lines. As I said, I didn't check the syntax, but these are fairly bizarre errors -- have you done any other editing, or have you got the original script?

Suzanne's picture

She has: 5,507 posts

Joined: Feb 2000

Note: some of the escaping out is not showing up on the forums, so don't cut and paste. Go here instead: synapticimpulse.com/timewell.phps

I'll remove the page in the next day or so, so copy it to your own server for getting help from the other forum.

They have: 344 posts

Joined: Jun 2002

Thanks I have that!

Why isn't there a submit button? What is the code for a Select menu?

Suzanne's picture

She has: 5,507 posts

Joined: Feb 2000

Quote: Originally posted by Timewell
Why isn't there a submit button?

Because you didn't put one in.

Quote: What is the code for a Select menu?

test

They have: 344 posts

Joined: Jun 2002

ok, here is the new URL:

http://www.cmdirector.neosurge.net/stories.php

How can I make the Category dropdown have items in it? and also why has the white border got bigger?

Suzanne's picture

She has: 5,507 posts

Joined: Feb 2000

Timewell, I can't help you if you won't help yourself, hon.

is the TAG, if you want something to display, it has to go inside it...

News

Or alternatively,

The Value of the form goes for INPUT tags, but you put words between OPTION and TEXTAREA tags.

Okay, you're on your own from here good buddy! Smiling

They have: 344 posts

Joined: Jun 2002

Sorry to be a pain but this should be my last or second to last post in this thread. I just want to ask two questions!

1. How do I make the box to appear next to Category? (The drop-down!)
2. Why is my border messed up? I haven't altered any values.

They have: 344 posts

Joined: Jun 2002

Help would be much appreciated! I just need this and then my forms are finished! Smiling

Suzanne's picture

She has: 5,507 posts

Joined: Feb 2000

1. put it in the correct table cell.
2. probably a problem with the table.

htmlvalidator.com
http://validator.w3.org

They have: 344 posts

Joined: Jun 2002

What do you mean when you say the correct table? Should the code by lower down? ie.

<tr>
<td align="centre"><font color="#5500ee">Category</font></td>
<select id="category">
<option id="CM 01/02">CM 01/02</option>
<option id="CM 4">CM 4</option>
<option id="The Weird World of CM">The Weird World of CM</option>
<option id="My Cup Glory">My Cup Glory</option>
<option id="The Dizzy Heights of Relegation">The Dizzy Heights of Relegation</option>
</select>
</tr>
'

get rid of ?

Suzanne's picture

She has: 5,507 posts

Joined: Feb 2000

so, say you use the validator, you think it would notice that you don't have that select box IN a table cell at all? I think it would. Why not try it?

Come on, Timewell, give it a go!

They have: 344 posts

Joined: Jun 2002

What do I do when the Validator has finished its trial period? Is there any more free ones which can be downloaded from the net, that are good?

Suzanne's picture

She has: 5,507 posts

Joined: Feb 2000

The second validator is online, Timewell...

They have: 344 posts

Joined: Jun 2002

Well I have spotted the form error myself! How clumsy of me! :blush:

But the border thing is really stumping me. There was no reference to it in the Validator and the online thing says I need a DocType whatever one of them is...

They have: 344 posts

Joined: Jun 2002

It is ok! I fixed it! My footer was wrong...Sad

They have: 344 posts

Joined: Jun 2002

I now get this error:

When testing the form and after filling it in, I get the message that I haven't filled in the Category field when I have...

Suzanne's picture

She has: 5,507 posts

Joined: Feb 2000

And you've checked to make sure that your select id or name is the same as the field name you set as required?

They have: 344 posts

Joined: Jun 2002

How do you set a field so that it is required? At the moment it is:

Category

CM 01/02
CM 4
The Weird World of CM
My Cup Glory
The Dizzy Heights of Relegation

They have: 344 posts

Joined: Jun 2002

Is the problem occuring because I am missing some code?

Suzanne's picture

She has: 5,507 posts

Joined: Feb 2000

If you don't validate your code first, how are you going to learn?

As for making it required, read back through this thread, I answered that before.

They have: 344 posts

Joined: Jun 2002

Hi!

I didn't really want to bring this thread up again but I thought it would be best to.

Is it possible to run more than one form using the same script but on different pages? I used the fixed script that you did Suzanne, many thanks for that! But I get this error:

It is like the one I used to have so I think it must be that you cannot run two scripts yeah?

http://cmdirector.neosurge.net/general/jobcentre.shtml

They have: 344 posts

Joined: Jun 2002

I think I should have started a new thread!

Busy's picture

He has: 6,151 posts

Joined: May 2001

you can run two scripts on one page as long as the variable names arent the same, just having one the same can cause big problems

Abhishek Reddy's picture

He has: 3,348 posts

Joined: Jul 2001

Seems to me you possibly have incorrect tags <?php missing or misplaced for the second (?) part, so it won't be parsed. Can you post the whole source code of the page here?

They have: 344 posts

Joined: Jun 2002

It's ok guys! I have fixed it! The reason was that I didn't save it as .php! Roll eyes

Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.