TalkPHP
 
 
Account Login
Latest Articles
» The basic usage of PHPTAL, a XML/XHTML template library for PHP
» Vulnerable methods and the areas they are commonly trusted in.
» Simple way to protect a form from bot
» The Basics On: How Session Stealing Works
» How to keep your forms from double posting data
IRC Channel
IRC Speech Bubble Join the friendly bunch on IRC...
(#TalkPHP on Freenode)

...Also available via a web interface.

See this thread for information on the TalkPHP Free Hugs Initiative™. Subject to availability.
Associates
Associates
CSS Tutorials
 
 
LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
Old 05-06-2009, 11:41 PM   #1 (permalink)
The Acquainted
 
Randy's Avatar
 
Join Date: May 2007
Location: Your G/F's Closet
Posts: 114
Thanks: 7
Randy is on a distinguished road
Default UPDATE MySQL data via web forms?

So i am working on a CMS for a certain genre of websites, not much detail is needed but I am having some issues. I am trying to make it for that they can update the website details from a php page and for some reason it wont update the database..

Form/PHP:
PHP Code:
            <?php

                
if (isset($_POST['submit'])) {

                            
// Define Variables
                            
$websitename $_POST['websitename'];
                            
$tagline $_POST['tagline'];
                            
$websiteurl $_POST['websiteurl'];
                            
$contactemail $_POST['contactemail'];
                            
                        
// Attempt To Update
                        
$update mysql_query"UPDATE settings SET `sitename` = '$websitename' ") or die(mysql_error());
                            if(
mysql_num_rows($update) > 0
                                
{
                                        echo 
'SUCCESS';
                                }
                            else
                                {
                                        echo 
'FAILZOR';
                                }
                        
                } else {
            
?>
              <form action="" method="POST" id="settings" name="settings ">
                Website Name: <br />
                <label class="mediumInput">
                  <input name="websitename" id="websitename" type="text" size="75" />
                  </label>
                <br />
                <small>This will show up in the tab bar in your browser and all over the website.</small>
                <p>Tagline (Description): <br />
                  <label class="textareasmall">
                    <textarea name="tagline"  id="tagline" rows="2" cols="5"></textarea>
                  </label>
                <br />
                <small>This will show up on search engines under the name and will give a basic description of your website.</small></p>
                <p>Website URL: <br />
                  <label  class="mediumInput">
                    <input type="text" name="websiteurl" id="websiteurl" size="75"/>
                  </label>
                  <br />
                  <small>This is the URL to where you have this installed, It is recommend you do not change unless you know what you are doing.</small></p>
                <p>Contact Email: <br />
                  <label class="mediumInput">
                    <input name="contactemail" id="contactemail" type="text" size="75" />
                  </label>
                <br />
                <small>This is where emails will be sent to when contact form is used, as well as when emails are sent out.</small></p>
                <p>
            <input name="submit" id="submit" type="image" src="../images/bt_submit.gif" />
                  </p>
              </form>
              <?php
                
}
                
?>
I have updated the entire file here:
http://pastie.org/470648
PHP for Form starts on line: 170

Im not sure why its not updating, i know all my variables are right. I don't receive any errors at all, I hit submit and it just reloads the page and removes all entered text on the input
__________________
Real Programmers always confuse Christmas and Halloween because Oct31 == Dec25 - Andrew Rutherford
Send a message via AIM to Randy Send a message via MSN to Randy
Randy is offline  
Reply With Quote
 



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
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

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

Similar Threads
Thread Thread Starter Forum Replies Last Post
Basic php form update mysql script dp2 Absolute Beginners 3 03-11-2009 04:06 PM
mysql update with multi fields sarmenhb Absolute Beginners 1 02-06-2009 10:03 PM
You are subscribed to this thread mysql update with multi fields sarmenhb Advanced PHP Programming 0 11-15-2008 05:00 AM
mysql update with multi fields sarmenhb General 0 11-15-2008 04:19 AM
Log User Data with PHP & MySQL mortisimus Absolute Beginners 6 09-30-2007 05:52 PM


All times are GMT. The time now is 06:10 AM.

 
     

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0
Inactive Reminders By Icora Web Design