Go Back   Free website templates > Web Template Help > PHP and MySQL
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read


Join now to share free website templates or post on the forum. If you have never been on a forum before read the FAQ. It's quick, easy and free to join!
Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 06-10-2009, 12:48 PM
Junior Member
 
Join Date: Jun 2009
Posts: 3
smartlipo is on a distinguished road
Default Using a PHP Function within a HTML FORM?

I am trying to launch a PHP Function from a FORM;


Currently I am running the Action as a seperate PHP page - like below;

<form enctype="multipart/form-data" action="uploadCSV.php" method="POST">
Please choose a file: <input name="uploaded" type="file" /><br />
<input type="submit" value="Upload" />
</form>

But I am having difficulty returning a Success or Failure back to this PHP page - can you call a PHP function in the "action=" instead of calling a new PHP page?

Thanks for any help,
Reply With Quote
  #2 (permalink)  
Old 06-10-2009, 03:39 PM
ishkey's Avatar
Moderator
 
Join Date: Aug 2007
Location: North GA USA
Posts: 1,778
ishkey will become famous soon enough
Default

You might be misunder standing php.

When someone visits your PHP webpage, your web server processes the PHP code. It then sees which parts it needs to show to visitors(content and pictures) and hides the other stuff(file operations, math calculations, etc.) then translates your PHP into HTML. After the translation into HTML, it sends the webpage to your visitor's web browser.

In your case a form - the viewer fills out. (File 1)
The information is sent to a php file residing on the server, which processes the information. (File 2)
If all goes well the file returns Success if not Failure. (File 3 dispayed in browser, generated by File 2)

Your declaration
Code:
="multipart/form-data" action="
Set this scenario up.

My guess would be there is a problem with the php file on your server in proccessing the input, therfore no output.

There are several php commands which if coded in a page return output, as they are processed on the server side, but this not your case.
__________________

Consultant - Programmer - WebMaster
cleandeck - lawn mower undercoating
wilmargraphite - graphite lubricants

Last edited by ishkey; 06-10-2009 at 07:38 PM.
Reply With Quote
  #3 (permalink)  
Old 08-01-2009, 05:03 PM
bmcoll3278's Avatar
Senior Member
 
Join Date: Jun 2009
Posts: 303
bmcoll3278 is on a distinguished road
Default

Your form looks ok here is a free cgi script to do the upload. be sure the file permision is set to 755 or 777 for the folder you want to upload to and this script should work for you.
Reply With Quote
  #4 (permalink)  
Old 08-01-2009, 05:05 PM
bmcoll3278's Avatar
Senior Member
 
Join Date: Jun 2009
Posts: 303
bmcoll3278 is on a distinguished road
Default the file

sorry I messed up attaching the file
Attached Files
File Type: zip upload.zip (8.8 KB, 81 views)
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT. The time now is 12:38 PM.



mouseover mouseover mouseover