Asterixx Posted March 24, 2006 Share Posted March 24, 2006 PHP beginner here...[code]<?phpinclude("config.php"); if($submit) {include('post.txt');if(!$contact){ //this means If the title is really empty.echo "Error: Contact is a required field. Please fill it.";exit(); //exit the script and don't do anything else. }$result = mysql_query("INSERT INTO AL_BVA (contact, time, phone, address, city, state, zip, email, website, notes)VALUES ('$contact',NOW(),'$phone','$address','$city','$state','$zip','$email','$website','$notes')",$connect); echo "Contact added"; echo "<meta http-equiv=Refresh content=4;url=bvaindex.php>"; }else { ?><?include('form.txt');?> <? } mysql_close($connect);?>[/code]FORM.TXT[code]<br> <h3>::Add Contact::</h3> <form method="post" action="<?php echo $PHP_SELF ?>"> Contact: <input name="contact" size="40" maxlength="50"> <br> Phone: <input name="phone" size="20" maxlength="20"> <br> Address: <input name="address" size="40" maxlength="100"> <br>City: <input name="city" size="40" maxlength="50"> <br>State: <input name="state" size="4" maxlength="4"> <br> Zip: <input name="zip" size="20" maxlength="20"> <br> Email: <input name="email" size="40" maxlength="50"> <br> Website: <input name="website" size="40" maxlength="50"> <br> Notes: <textarea name="notes" rows="7" cols="30"></textarea><br> <input type="submit" name="submit" value="Add Contact"> </form>[/code]POST.TXT[code]<? $contact = $_POST['contact']; $phone = $_POST['phone']; $address = $_POST['address']; $city = $_POST['city']; $state = $_POST['state']; $zip = $_POST['zip']; $email = $_POST['email']; $website = $_POST['website']; $notes = $_POST['notes'];?>[/code]I'm trying to do what I did with these 2 .txt files with the data after AL_BVA and VALUES, so I can edit it from an external file. I can currently edit these 2 .txt files and the form works in over 100 pages.I've tried stuff like what follows but that gives me a parsing error.[code]$result = mysql_query("INSERT INTO AL_BVA (include'data.txt') VALUES (include'values.txt')",$connect);[/code]I desperately need this to work. :)Thanks in advance!P.S.: the server runs PHP4+ Quote Link to comment Share on other sites More sharing options...
ober Posted March 24, 2006 Share Posted March 24, 2006 I don't know what you're trying to do. You can't include the contents of a text file like that in the middle of a string. It doesn't work like that. Quote Link to comment Share on other sites More sharing options...
Asterixx Posted March 24, 2006 Author Share Posted March 24, 2006 Thanks! Finally someone giving me a straight answer.If I can't use Include, what can I use? Is it not possible? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.