Computing.Net > Forums > Web Development > form function errors

form function errors

Reply to Message Icon

Original Message
Name: FBI Agent
Date: June 23, 2004 at 18:53:45 Pacific
Subject: form function errors
OS: WIN XP
CPU/Ram: 1.79Ghz/ 384 RAM
Comment:

if (empty($name)) {
header("Location: {$app_url}?action=no_name");
}
// check email field
elseif (!(preg_match("/@/", "$email") && preg_match("/\./", "$email")) || preg_match("/\s/", "$email")) {
header("Location: {$app_url}?action=invalid_email");
}
// check subject field
elseif (empty($subject)) {
header("Location: {$app_url}?action=no_subject");
}
// check comments field
elseif (empty($comments)) {
header("Location: {$app_url}?action=no_comments");
}
else header("Location: {$app_url}?action=send");
}


for some reason, when it proceeds to the function send() it doesnt keep any of the variables, like name or subject. is there anything that i can do to make it so it remembers?

FBI_Agent


Report Offensive Message For Removal

Response Number 1
Name: Khalid
Date: June 24, 2004 at 07:43:33 Pacific
Subject: form function errors
Reply: (edit)

You are using a script to review the form-input from a user to check to see if everything is ok, and then want the same form-input to be sent to another script?
You can use a session-cookie to hold the data between the different files. Or you can use javascript (clientsided) to check the form instead of php (serversided) so you only need to call this script once.
Or; if all this checking you wrote is a the beginning of a file, and no headers have been sent, you can use this file to process the form input...


Report Offensive Follow Up For Removal

Response Number 2
Name: FBI Agent
Date: June 24, 2004 at 15:12:38 Pacific
Subject: form function errors
Reply: (edit)

im not sure if a cookie will work. after it checks all the form of errors, it sends it to another part on the same php file, like when the function changes, it doesnt retain any of the variables... i dont know. i've tried a lot of things and it doesnt work. if you really think cookies will work, i can try it, however, i dont know anything about them. so if you would be so kind to help me out with sessions, that'd be great, otherwise, i think ill just die :0

FBI_Agent


Report Offensive Follow Up For Removal







Use following form to reply to current message:

   Name: From My Computing.Net Settings
 E-Mail: From My Computing.Net Settings

Subject: form function errors

Comments:

 


  Homepage URL (*): 
Homepage Title (*): 
         Image URL: 
 
Data Recovery Software