Page 1 of 1
Submit Review Form help
Posted: Wed Jan 03, 2007 7:55 am
by JoseAgua
Hello, I am creating a PHP "Submit a Review" form for a website. I have searched across google and cant find any helpful links. How would i go about creating code for this? Thank you in advance
Posted: Wed Jan 03, 2007 8:11 am
by jyhm
- make the form.
use php to write data to text or database
use php to view data on page
Form
Posted: Wed Jan 03, 2007 9:36 am
by timclaason
feyd | Please use Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
This is kind of a loaded question. You can really spend all day talking about stuff like this to a person who is starting from scratch (ie has no experience in web development). You need to understand querystrings, post and get form methods, How to retreive form values with $_POST and $_GET, how to put that data somewhere (whether it sends out an email or puts it into a database), and if you put it into a database, you need to understand connection strings, database schemas, how to retreive data from a database, etc.
All that aside, here's how I'd do a simple "Submit a review".
Assuming that the review is for the entire website or that there is only one thing to review, you can make the page like this:
[syntax="html"]
<HTML>
<HEAD>
...
<FORM METHOD='POST' ACTION='whateverPageYouArePostingTo.php'>
<TABLE>
<TR>
<TD>Your Review</TD>
<TD><TEXTAREA COLS='8' ROWS='50' NAME='review'></TEXTAREA></TD>
</TR>
<TR>
<TD COLSPAN='2' ALIGN='RIGHT'><INPUT TYPE='SUBMIT' VALUE='Submit Review'></TD>
</TR>
</TABLE>
</FORM>
And then on whateverPageYouArePostingTo.php:[/syntax]
Code: Select all
$posterReview = $_POST['review'];
//Assuming you have a database with all reviews:
//Do connection string and database selection
//Then do input checking on variable $posterReview
//Then do the query:
$query = "INSERT INTO reviews (fld_review) VALUES ($posterReview)";
$SQL = mysql_query($query, $databaseLink);
There's a lot of components to this question. I would do a search for some of the above things I mentioned.
feyd | Please use Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]