I would appreciate some help extracting data from a url paramater and putting it in my php process page. Right now I have the form on the page and a hidden input with the id of 'page1'. I would like it if I could have a link to the form with the id in the parameter, But I cannot figure out how to insert the "product-id" parameter into my php page. Any help or a point in the right direction would be extremely helpful. THanks I would like to have a like open up with this command javascriptpenwin('reviewform','review-from.html?product-id=page1','450','450') These are what I am using now. Html Form <form method=post action="process.php" method="post" name="tlreviewform" id="rev-form-field1"> <input type="hidden" name="id" value="page1">How do you rate this item? <select name="rating"> <option value="" selected="selected">-</option> <option value="5" >5 stars</option> <option value="4" >4 stars</option> <option value="3" >3 stars</option> <option value="2" >2 stars</option> <option value="1" >1 stars</option> </select><br>Your Name:<br><input name="reviewname" type="text" size="35"> <br>Your Location (City, State) <br><input name="location" type="text" size="35"><br> Type your review in the space below:<br><textarea name="review" rows="5" cols="40" rows="5"></textarea><br> <input type="submit" value="submit"><input type="hidden" name=".autodone" value="/review-form.html" /></form> Code (markup): Php Process <? $id=$_POST['id']; $rating=$_POST['rating']; $reviewname=$_POST['reviewname']; $location=$_POST['location']; $review=$_POST['review']; $todate=date("Y-m-d"); if ($rating == "5"){ $ratingresult = "<img src=images/star5.gif>"; } elseif($rating == "4"){ $ratingresult = "<img src=images/star4.gif>"; } elseif($rating == "3"){ $ratingresult = "<img src=images/star3.gif>"; } elseif($rating == "2"){ $ratingresult = "<img src=images/star2.gif>"; } elseif($rating == "1"){ $ratingresult = "<img src=images/star1.gif>"; }else { $ratingresult = "No Rating"; }; $entirereview = "<div id=\"reviewholder\"><div class=rev-rating>".$ratingresult."</div> <div class=\"rev-date\">".$todate."</div><div class=\"rev-by\">By:</div><div class=\"rev-name\"> ".$reviewname."</div><div class=rev-location>".$location."</div><div class=rev-review>".$review."</div></div>"; mysql_connect("mysql", "username", "pass") or die(mysql_error()); mysql_select_db("reviews") or die(mysql_error()); mysql_query("INSERT INTO `data` (id,entirereview) VALUES ('$id', '$entirereview')"); Print "Your information has been successfully added to the database."; ?> Code (markup):
Indent. Indent. Indent. Do not use "id" as a form field name, it's a reserved word. I doubt that this is a valid name: name=".autodone" because of the period. Do not use: javascriptpenwin('reviewform','review-from.html?product-id=page1','450','450') Use instead: openwin('reviewform','review-from.html?product-id=page1','450','450') <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <title>Any Title</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <script type="text/javascript"> function init(){ var nID = location.search.substring(location.search.lastIndexOf('=')+1,location.search.length); document.forms[0]['prod_id'].value = nID; } onload=init; </script> <style type="text/css"> body {background-color:#eae3c6;margin-top:60px} form {width:620px;margin:auto;font-family:times;font-size:12pt} form input {text-align:right} fieldset {width:610px;background-color:#f0fff0;border:1px solid #87ceeb} legend {font-family:times;font-size:14pt;color:#00008b;background-color:#87ceeb;padding-left:3px;padding-right:3px;margin-bottom:5px} .submitBtn {font-family:tahoma;font-size:10pt;display:block;margin-left:auto;margin-right:auto;margin-top:5px;margin-bottom:5px} </style> </head> <body> <form action="process.php" method="post"> <fieldset> <legend>Test Form</legend> <input type="hidden" name="prod_id" value=""> How do you rate this item? <select name="rating"> <option value="" selected>Choose</option> <option value="5" >5 stars</option> <option value="4" >4 stars</option> <option value="3" >3 stars</option> <option value="2" >2 stars</option> <option value="1" >1 stars</option> </select> <br>Your Name: <br><input name="reviewname" type="text" size="35"> <br>Your Location (City, State) <br><input name="location" type="text" size="35"> <br>Type your review in the space below: <br> <textarea name="review" rows="5" cols="40" rows="5"> </textarea> <br> <input type="hidden" name=".autodone" value="/review-form.html"> <input type='submit' name='submit' value="Submit" class='submitBtn'> </fieldset> </form> </body> </html> Code (markup):