PHP - Beginners Help
I need some helping with writing code for a web page that allows users to enter information in a PHP form along with proceeding to a PayPal payment page after entering the info. The information entered will be added to an SQL database, and only added after payment confirmation, then have those database entries expire after 1 month.
This is what I have got so far, not sure if it is even correct. If it is, then I just need to added PayPal payment and SQL database expiration code. <html> <head> <title>Server Donation Page</title> </head> <body> <?php $hostname = "hostname"; $db_user = "dbuser"; $db_password = "dbpassword"; $database = "database"; $db_table = "table"; $db = mysql_connect($hostname, $db_user, $db_password); mysql_select_db($database,$db_table); if (isset($_REQUEST['Submit'])) { $sql = "INSERT INTO $db_table(id,user_email) values ('".mysql_real_escape_string(stripslashes($_REQUEST['id']))."','".mysql_real_escape_string(stripslashes($_REQUEST['user_email']))."')"; if($result = mysql_query($sql ,$db)) { echo '<h1>Thank you,</h1> your information has been entered into our database sucessfully.<br><br><img src=""'; } else { echo "ERROR: ".mysql_error(); } } else { ?> <h1>Server Donation Page</h1><hr> <form method="post" action=""> Steam ID (format STEAM_0:x:xxxxxxxx, go to <a href="http://www.steamidfinder.com">Steam ID Finder</a>):<br> <input type="text" name="id"> <br> Your Email: <br> <input type="text" name="user_email"> <br><br> <input type="hidden" name="authtype" value="steam" /> <input type="hidden" name="flags" value="o" /> <input type="hidden" name="immunity" value="0" /> <input type="hidden" name="identity" value="donator" /> <input type="submit" name="Submit" value="Submit"> </form> <?php } ?> </body> </html> Thanks in advance! Similar TutorialsHi, I rarely deal with PHP, so this may sound very easy, but I am struggling to figure out what to do. Basically I have created a website for a client that allows for customers to pay for certain packages using Paypal. They select the package they want, which then takes them to a data input page (email, tel no, name etc). Once they click submit, that information gets emailed to my client, and the customer is presented with the relevant Paypal page. What I need is on each data input page, for a checkbox to be available, so if the customer checks the checkbox, they get taken to a different paypal page rather than if they leave it blank. So really, what I need is if the checkbox is left blank and that page is submitted, the customer goes to Page A. If the checkbox is checked and they click submit, the customer goes to Page B. Any help would be greatly appreciated! Cheers Graeme Hi guys,
I'm a beginner in php.I know some basic codings in it.I want to do the project in php.Help me how to start..?..and what kind of project is best for beginners to learn..?
Hi - I know this is a #101 question but here goes! I simply want to select a single row from a table and use the columns fields as variables that can then be posted in a form. $result = mysql_query("SELECT * from tblquestions WHERE qid='1'"); if (!$result) { echo 'Could not run query: ' . mysql_error(); exit; } $row = mysql_fetch_row($result); $oid=$result['oid']; $qid=$result['qid']; $question=$result['question']; The code above isn't working - as when I try to echo each variable <?php echo $question;?> nothing is being shown on screen. I'm obviously barking up the wrong tree in the way I'm trying to create the variable - but don't really have any idea where to look next. |