Jump to content

Search the Community

Showing results for tags '$_request'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • Welcome to PHP Freaks
    • Announcements
    • Introductions
  • PHP Coding
    • PHP Coding Help
    • Regex Help
    • Third Party Scripts
    • FAQ/Code Snippet Repository
  • SQL / Database
    • MySQL Help
    • PostgreSQL
    • Microsoft SQL - MSSQL
    • Other RDBMS and SQL dialects
  • Client Side
    • HTML Help
    • CSS Help
    • Javascript Help
    • Other
  • Applications and Frameworks
    • Applications
    • Frameworks
    • Other Libraries
  • Web Server Administration
    • PHP Installation and Configuration
    • Linux
    • Apache HTTP Server
    • Microsoft IIS
    • Other Web Server Software
  • Other
    • Application Design
    • Other Programming Languages
    • Editor Help (PhpStorm, VS Code, etc)
    • Website Critique
    • Beta Test Your Stuff!
  • Freelance, Contracts, Employment, etc.
    • Services Offered
    • Job Offerings
  • General Discussion
    • PHPFreaks.com Website Feedback
    • Miscellaneous

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


AIM


MSN


Website URL


ICQ


Yahoo


Jabber


Skype


Location


Interests


Age


Donation Link

Found 2 results

  1. please tell me about the error in this code and help me to resolve the error <html> <head> <title> using one page to accept and process data. </title> </head> <body> <h1> using one page to accept and process data. </h1> <?php if (isset($_REQUEST ["flavour"]) ) { echo "your favourite flavour is". $_REQUEST["flavour"] ; } ?> <?php if (isset($_REQUEST["name"] ) ) { echo "your name is" . $_REQUEST["name"]; } else { ?> <form method = "post" action = "phpone.php"> what is your favourite ice cream flavor? <input name = "flavor" type = "text"> <br> <br> what is your name? <input type = "text" name = "name" > <br> <br> <input type = submit value = submit > </form> <?php } ?> </body> </html> phpone1.php
  2. Bear with me, I'm new to PHP and MySQL. Ok, so strange thing. Last night, I'm coding it up, everything's working great. Go to bed, wake up, now my form isn't working. Literally 9 hours before, it was. Nothing changed, suddenly isn't working. I have 2 files, form.php and insert.php. form.php: <html> <head> <title>YAY!</title> </head> <body> <h2>Register Form</h2> <form method="get" action="insert.php"> <table border="0" width="60%"> <tr> <td width="10%">Referred By: </td><td><input type="text" name="referredby" /></td> </tr> <tr> <td width="10%">Email: </td><td><input type="text" name="email" /></td> </tr> <tr> <td width="10%">Name: </td><td><input type="text" name="name" /></td> </tr> <tr> <td width="10%">Password: </td><td><input type="text" name="password" /></td> </tr> <tr> <td width="10%">Earned: </td><td><input type="text" name="earned" /></td> </tr> <tr> <td width="10%">Image: </td><td><input type="text" name="image" /></td> </tr> </table> <p> <input type="submit" value="Register" /> <input type="reset" value="reset" /> </form> </body> </html> insert.php: <?php $referredby = $_REQUEST['referredby']; $email = $_REQUEST['email']; $name = $_REQUEST['name']; $password = $_REQUEST['password']; $earned = $_REQUEST['earned']; $image = $_REQUEST['image']; if($email && $name && $password && $password && $earned) { mysql_connect("dbserver", "username", "password") or die("Problem connecting to the database server. Please contact administrator at <link to contact form here> with the following error message: " . mysql_errno() . ": " . mysql_error() . "<br />" ); mysql_select_db("database"); mysql_query("INSERT INTO desiredtable(referredby,email,name,password,earned,image) VALUES('$referredby','$email','$name','$password','$earned','$image')"); $registered = mysql_affected_rows(); echo "$name was successfully registered! $registered row(s) added to the table."; mysql_close(); }else{ echo "You have to complete the form<br />"; echo "Email: " . $email . "<br />" . "Name: " . $name . "<br />" . "password: " . $password . "<br />" . "Earned: " . $earned . "<br />"; } echo mysql_errno() . ": " . mysql_error() . "<br />"; echo "<a href=\"form.php\">Return to the previous page</a>" ?> Now, here's the kicker. When I fill out the form and click register, I have my else { } statement echo the $_REQUEST[ ] variables (added that for troubleshooting), and it's displaying the contents correctly. I even changed my form from method="post" to method="get" to verify in the address bar. Apparently, everything before and after the initial IF statement conditions are working correctly. It's the conditions that are not, which doesn't make sense, because as I said, I was using it last night in order to add entries into my table. It's probably something really simple stupid, and I'm hoping you can help me out with it :/ FYI, this is set up under a XAMPP installation on my PC
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.