Go Back   TechArena Community > Software > Software Development
Become a Member!
Forgot your username/password?
Tags Active Topics RSS Search Mark Forums Read

Reply
 
Thread Tools Search this Thread
  #1  
Old 06-05-2009
Member
 
Join Date: Apr 2009
Posts: 6
Problem in PHP form

I have created a form that sends data in my database sql. Thats goes well only if the fields are empty, data is transmitted in the base. I try to use the empty but it not work, My friend told me to use the trim but that also didn't work.

Can someone help me ?

Thanks
Reply With Quote
  #2  
Old 06-05-2009
Member
 
Join Date: May 2008
Posts: 29
Re: Problem in PHP form

Surely we will help you can you post your coding ? So that we will come to know your coding is correct or not.
Reply With Quote
  #3  
Old 06-05-2009
Member
 
Join Date: Apr 2009
Posts: 6
Re: Problem in PHP form

Sorry i forget to post code.

Code:
<? php 

mysql_connect ( "localhost", "root", "") OR die ( 'Error selecting database'); 
mysql_select_db ( "camping") or die ( 'Error selecting database'); 
/ / (=> Useless 

$ name = $ _POST [ 'name']; 
$ first_name = $ _POST [ 'firstname']; 
$ address = $ _POST [ 'address']; 
$ PostalCode = $ _POST [ 'PostalCode']; 
$ city = $ _POST [ 'city']; 
$ telephone = $ _POST [ 'telephone']; 
$ mail = $ _POST [ 'mail']; 
$ message = $ _POST [ 'message']; 

if (empty ($ name) & & ($ firstname) & & empty ($ address) & & empty ($ PostalCode) & & empty ($ city) & & empty ($ telephone) & & empty ($ mail) & & empty ($ message)) 
( 
echo ( "There is an empty field"); 
) else 
( 
echo ( "fields filled"); 

)

$ req = mysql_query ( 'INSERT INTO clients (name, surname, address, Postcode, city, telephone, mail, message) VALUES ("'.$ name.' "" '. $ firstname.' "" '. $ address. ' ""'. $ PostalCode. ' ""'. $ city. ' ""'. $ telephone. ' ""'. $ mail. ' ""'. $ message. ") ') or die (mysql_error ()); 
if ($ req) 
( 
echo 'enregisttrement reussi'; 
) 
else 
( 
echo 'There was a problem <br/>. $ req; 
) 



mysql_close (); 
>
Reply With Quote
  #4  
Old 06-05-2009
Member
 
Join Date: May 2008
Posts: 29
Re: Problem in PHP form

function empty () "is very applicable. your problem that the instruction "INSERT" must be executed in the instruction "else" because your code following the instruction "INSERT" is executed as it is found outside the instruction "else" .
Reply With Quote
Reply

  TechArena Community > Software > Software Development
Tags: ,



Thread Tools Search this Thread
Search this Thread:

Advanced Search


Similar Threads for: "Problem in PHP form"
Thread Thread Starter Forum Replies Last Post
Google Chrome is opening in basic HTML form instead of the Standard form Beatrix Technology & Internet 5 25-05-2011 10:21 PM
how to get items in a form to auto-resize with the form using visual basic deansmylie93 Software Development 2 02-05-2011 07:06 AM
Problem in form submission Udyan Software Development 4 30-01-2010 04:28 PM
Problem of form that sends a get instead of post HarshaB Software Development 3 14-10-2009 10:26 PM
Problem reloading MDI child form in main form. AFFAN Software Development 3 30-01-2009 09:05 PM


All times are GMT +5.5. The time now is 07:55 PM.