RussellReal
Members-
Posts
1,773 -
Joined
-
Last visited
Everything posted by RussellReal
-
[SOLVED] php and mysql contact Script problem
RussellReal replied to ace2721's topic in PHP Coding Help
also, and sorry for the double post (I want the email notification to be resent to ace) your mysql_close.. ahhh I'll just move it for you <div id="enquire_form"> <?php // Connect to database $hostname = ""; $username = ""; $password = ""; $dbname = ""; $usertable = ""; $f_name = $_REQUEST['f_name']; $postcode = $_REQUEST['postcode']; $tel = $_REQUEST['tel']; $mobile = $_REQUEST['mobile']; $email = $_REQUEST['email']; $course = $_REQUEST['course']; mysql_connect($hostname, $username, $password) or DIE("Unable to connect to MySQL server $hostname"); $selected = mysql_select_db($dbname) or DIE("Could not select requested db $dbname"); $errmsg = ''; // error message $f_name = ''; // sender's name $postcode = ''; // sender's name $tel = ''; // message tel $mobile = ''; // message tel $email = ''; // sender's email addres $course = ''; // the message itself if(isset($_POST['send'])) { $f_name = $_POST['f_name']; $postcode = $_POST['postcode']; $tel = $_POST['tel']; $mobile = $_POST['mobile']; $email = $_POST['email']; $course = $_POST['course']; if(trim($f_name) == '') { $errmsg = 'Please enter your name'; } else if(trim($postcode) == '') { $errmsg = 'Please enter your postcode'; } else if(trim($tel) == '') { $errmsg = 'Please enter Your Telephone Number:'; } else if(trim($mobile) == '') { $errmsg = 'Please enter your mobile'; } else if(trim($email) == '') { $errmsg = 'Please enter your email address'; } else if(!isEmail($email)) { $errmsg = 'Your email address is not valid'; } else if(trim($course) == '') { $errmsg = 'Please enter the course your interested in'; } if($errmsg == '') { if(get_magic_quotes_gpc()) { $tel = stripslashes($tel); $message = stripslashes($message); } $query = "INSERT INTO pitman (id, f_name, postcode, tel, mobile, email, course, pdate) VALUES ('', '$f_name', '$postcode', '$tel', '$mobile', '$email' , '$course', NOW())"; $result = mysql_query($query) or DIE("Could not Execute Query on table $usertable"); // the email will be sent here $to = ""; $user_message .= "Name: $f_name "; $user_message .= "postcode: $postcode "; $user_message .= "tel: $tel "; $user_message .= "mobile: $mobile "; $user_message .= "email: $email "; $user_message .= "course: $course "; $headers = "- "; $headers .= "Reply-To: $email"; mail('',,$user_message,$headers); ?> <div align="center" class="boldenquire">Your message has been sent </div> <?php } } mysql_close(); if(!isset($_POST['send']) || $errmsg != '') { ?> <div align="center" class="ermsg"><?=$errmsg;?></div> <form method="post" name="msgform" id="msgform"> <table border="0" align="center" cellpadding="2" cellspacing="1" class="maincell"> <tr> <td align="center" colspan="2"><span class="boldenquire"> Please fill in your details <br /> for more information.</span></td> </tr> <tr> <td>Your Name</td> <td><input name="f_name" type="text" class="eqform" value="<?=$f_name;?>" style="width:100px" /></td> </tr> <tr> <td>Nearest centre</td> <td><label> <select name="postcode" size="1" class="eqform" style="width:100px" value=" <?=$postcode;?>"> <option value="Ashford">Ashford</option> <option value="Bromley">Bromley</option> <option value="Chatham">Chatham</option> <option value="Dartford">Dartford</option> <option value="Gravesend">Gravesend</option> <option value="Maidstone">Maidstone</option> <option value="Tunbridge Wells">Tunbridge Wells</option> </select> </label></td> </tr> <tr> <td>Tel </td> <td><input name="tel" type="text" class="eqform" value="<?=$tel;?>" style="width:100px" /></td> </tr> <tr> <td>Mobile</td> <td><input name="mobile" type="text" class="eqform" value="<?=$mobile;?>" style="width:100px" /></td> </tr> <tr> <td>Email </td> <td><input name="email" type="text" class="eqform" value="<?=$email;?>" style="width:100px" /></td> </tr> <tr> <td>Course of interest </td> <td><input name="course" type="text" class="eqform" value="<?=$course;?>" style="width:100px" /> </td> </tr> <tr align="center"> <td colspan="2"><input name="send" type="submit" value="Send Message" onclick="return checkForm();" /></td> </tr> <tr align="left"> <td colspan="2"><br /> <script language="JavaScript"> var addr = ''; var host = ''; var email = ''; document.write(email); </script></td> </tr> </table> </form> <?php } function isEmail($email) { return(preg_match("/^[-_.[:alnum:]]+@((([[:alnum:]]|[[:alnum:]][[:alnum:]-]*[[:alnum:]]).)+(ad|ae|aero|af|ag|ai|al|am|an|ao|aq|ar|arpa|as|at|au|aw|az|ba|bb|bd|be|bf|bg|bh|bi|biz|bj|bm|bn|bo|br|bs|bt|bv|bw|by|bz|ca|cc|cd|cf|cg|ch|ci|ck|cl|cm|cn|co|com|coop|cr|cs|cu|cv|cx|cy|cz|de|dj|dk|dm|do|dz|ec|edu|ee|eg|eh|er|es|et|eu|fi|fj|fk|fm|fo|fr|ga|gb|gd|ge|gf|gh|gi|gl|gm|gn|gov|gp|gq|gr|gs|gt|gu|gw|gy|hk|hm|hn|hr|ht|hu|id|ie|il|in|info|int|io|iq|ir|is|it|jm|jo|jp|ke|kg|kh|ki|km|kn|kp|kr|kw|ky|kz|la|lb|lc|li|lk|lr|ls|lt|lu|lv|ly|ma|mc|md|mg|mh|mil|mk|ml|mm|mn|mo|mp|mq|mr|ms|mt|mu|museum|mv|mw|mx|my|mz|na|name|nc|ne|net|nf|ng|ni|nl|no|np|nr|nt|nu|nz|om|org|pa|pe|pf|pg|ph|pk|pl|pm|pn|pr|pro|ps|pt|pw|py|qa|re|ro|ru|rw|sa|sb|sc|sd|se|sg|sh|si|sj|sk|sl|sm|sn|so|sr|st|su|sv|sy|sz|tc|td|tf|tg|th|tj|tk|tm|tn|to|tp|tr|tt|tv|tw|tz|ua|ug|uk|um|us|uy|uz|va|vc|ve|vg|vi|vn|vu|wf|ws|ye|yt|yu|za|zm|zw)$|(([0-9][0-9]?|[0-1][0-9][0-9]|[2][0-4][0-9]|[2][5][0-5]).){3}([0-9][0-9]?|[0-1][0-9][0-9]|[2][0-4][0-9]|[2][5][0-5]))$/i" ,$email)); } ?> </div> -
[SOLVED] php and mysql contact Script problem
RussellReal replied to ace2721's topic in PHP Coding Help
$result = mysql_query($query) or DIE("Could not Execute Query on table $usertable"); move that aswell put that under the declaration of $query -
background image and text floating on top please help
RussellReal replied to Orionsbelter's topic in PHP Coding Help
okay, some browsers pixels are screwy, like firefox is a lil bulkier in my opinion. but what you could try doing, is setting left and top to a percentage.. or use javascript to find out the precise available height in your browser window.. however, your best bet, is to just develop with lets say an EXPECTED width.. so if you EXPECT 1,000 pixels wide.. or 900 atleast you KNOW where the center of 900 is, ((900 - WidthOfElement) / 2) would be where you would start your element.. this doesn't AT ALL fall under PHP HELP sadly.. but I hope I helped atleast a little lol -
[SOLVED] php and mysql contact Script problem
RussellReal replied to ace2721's topic in PHP Coding Help
you too bro -
okay.. lets give an example I have a text file called blah.txt which contains \x3cb\x3eOMG NO FREAKING WAY\x3c/b\x3e now when I do $e = file_get_contents("blah.txt"); $e will contain the contents, EXACTLY as it was in the text file.. I want the hex to evaluate, I want to know if there is a function to do so. Thank you very much foir your replies so far guys
-
A general help with PHP/MYSQL/ Something else?
RussellReal replied to cs.punk's topic in PHP Coding Help
PHP is not meant to 'design' anything but images and some flash/actionscript.. its more so a data handling language, where it recieves/sends data, manipulates it, and bridges it over to a database or to an email or to a text file.. or where/what ever you decided to make the system do with your data.. php is completely SERVER SIDE, meaning, it just sends HTML and other clientside languages such as css and javascript to the CLIENT (browser) to be handled by the CLIENT (browser) the SERVER SIDE scripts never get touched or seen by the user.. if that makes any sence -
lol kat I came here and I was like.. he prolly generated a php image than probably tried to put the PHP code inside the TABLE lol.. but idk but for any affect, you can't generate an image with any stray data, or it ruins the image.. just fyi
-
update sql script fuctioning but not working
RussellReal replied to shadiadiph's topic in PHP Coding Help
dtupdated='(now()' also, you should get into the habbit of forming well formed strings and practice good syntax. for instance UPDATE `tableName` etc etc and '{$var}' instead of '$var' just {$var} in any case -
[SOLVED] php and mysql contact Script problem
RussellReal replied to ace2721's topic in PHP Coding Help
your problem is that before you check for blank information, you insert into your mysql database, try moving your insert query into the same if statement that you send the email in.. -
/(<[^>]+?>|^[^<]+?>|<[^>]+?$)/
-
I know the difference between single and double quotes.. if I deliberately set my variable with single quotes.. and then I want to make it evaluate at a later time in the script.. how would I go about doing that?
-
lets say I have this string '\n\t\r\n\n\x3C' is there a function which CAN properly handle each special escape char's special meaning.. I don't know how to explain it, I just hope someone can understand what I am trying to say.. I tried strip slashes but that just turns:\n\t\r\n\n\x3C into: ntrnnx3C and I want it to turn it into the special meanings