xuniter Posted January 10, 2011 Share Posted January 10, 2011 Hi, can someone help me to understand this? What i want to do is to write some information in a form and after i submit the form that data will be in a new php page. Thanks in advance Quote Link to comment Share on other sites More sharing options...
trq Posted January 10, 2011 Share Posted January 10, 2011 Probably not exactly what your after but should give you a good idea of how dynamic page creation works. http://www.phpfreaks.com/forums/php-coding-help/now-that-i-know-what-to-ask-here-goes/msg446570/#msg446570 Quote Link to comment Share on other sites More sharing options...
hyster Posted January 10, 2011 Share Posted January 10, 2011 follow the mysql tutorials. there easy to modify but remember to change <? to <?php else you may have problems http://phpeasystep.com/ Quote Link to comment Share on other sites More sharing options...
Pikachu2000 Posted January 10, 2011 Share Posted January 10, 2011 The tutorials on that web site are largely obsolete, and I wouldn't recommend learning from them. Quote Link to comment Share on other sites More sharing options...
xuniter Posted January 10, 2011 Author Share Posted January 10, 2011 thanks, but i want to know how to write the script so it could generate a .php with css... Quote Link to comment Share on other sites More sharing options...
BlueSkyIS Posted January 10, 2011 Share Posted January 10, 2011 http://www.google.com/search?client=safari&rls=en&q=php+form+tutorial&ie=UTF-8&oe=UTF-8 Quote Link to comment Share on other sites More sharing options...
trq Posted January 10, 2011 Share Posted January 10, 2011 thanks, but i want to know how to write the script so it could generate a .php with css... Your missing the point. Do you think every time you make a new post on this forum for instance, a new .php page is created? Quote Link to comment Share on other sites More sharing options...
xuniter Posted January 12, 2011 Author Share Posted January 12, 2011 ok now i will ask correctly sry about previous post, so how to make that the page will show different information using variables, example : www.domain.com/product.php?productid=42333 www.domain.com/product.php?productid=56326 It's the same page but it shows different info. Where can i read something about it or how it is called so i could search it Thank you very much Quote Link to comment Share on other sites More sharing options...
BlueSkyIS Posted January 12, 2011 Share Posted January 12, 2011 http://www.google.com/search?client=safari&rls=en&q=php+form+tutorial&ie=UTF-8&oe=UTF-8 Quote Link to comment Share on other sites More sharing options...
litebearer Posted January 12, 2011 Share Posted January 12, 2011 a VERY rough idea of how to do it. (NOTE - this example does NOT address any security issues)... The form page: <?PHP /* connect to your database */ include('db.php'); /* create the query */ $query = "SELECT id, product_name FROM FROM your_table_name WHERE id = '$productid'"; /* execute the query */ $result = mysql_query($query); /* display your form */ <!doctype html public "-//w3c//dtd html 3.2//en"> <html> <head> <title>Select A Product</title> </head> <body bgcolor="#ffffff" text="#000000" link="#000000" vlink="#000000" alink="#000000"> <form action="processpage.phpt" method="get"> <select name="productid"> <?PHP while($row = mysql_fectch_array($result)) { ?> <option value="<?PHP echo $row['id']; ?>"><?PHP echo $row['product_name']; ?></option><br> <?PHP } ?> </select> <input type="submit" value="Submit"> </form> </body> </html> The processing page: <?PHP /* put the passed value into a variable */ $productid = $_GET['productid']; /* connect to your database */ include('db.php'); /* create your query */ $query = "SELECT product_name, description, price, quantity, image FROM your_table_name WHERE id = '$productid'"; /* execute the query */ $result = mysql_query($query); /* put the results into an array */ $row = mysql_fetch_array($result); /* display the information how you want */ ?> <!doctype html public "-//w3c//dtd html 3.2//en"> <html> <head> <title>Information for <?PHP echo $row['product_name']; ?></title> </head> <body bgcolor="#ffffff" text="#000000" link="#000000" vlink="#000000" alink="#000000"> Product name : <?PHP echo $row['product_name']; ?><br> <IMG src="<?PHP echo $row['image']; ?>"><br> Product price : <?PHP echo $row['price']; ?><br> Quantity Avail : <?PHP echo $row['quantity']; ?><br> Product description : <?PHP echo nl2br($row['description']); ?><br> </body> </html> (Passing variables via GET) Quote Link to comment Share on other sites More sharing options...
trq Posted January 12, 2011 Share Posted January 12, 2011 ok now i will ask correctly sry about previous post, so how to make that the page will show different information using variables, example : www.domain.com/product.php?productid=42333 www.domain.com/product.php?productid=56326 It's the same page but it shows different info. Where can i read something about it or how it is called so i could search it Thank you very much That is also covered in the link I provided. Quote Link to comment Share on other sites More sharing options...
xuniter Posted January 13, 2011 Author Share Posted January 13, 2011 thanks litebearer & thorpe, finally i got the whole idea and can proceed with Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.