powW Posted April 9, 2011 Share Posted April 9, 2011 Well I have made a form in html and i need the information which is entered into the form to be shown to the user in a different page so I have a Ticket request page and i have made a Confirmation_Page.php Ticket request page: has this <form id="form1" name="form1" method="get" action="Confirmation_page.php"> The ticket request page has (Just one example so eg. the forename: </p> <p> <label>Forename <input type="text" name="Forname" id="Forname" /> </label> </p> <p> And corresponding to this in the Confirmation_Page.php it is : Your forename is : <?php echo $_GET["Forename"];?><br /> Now the thing is when I enter info in the form inside the ticket request page and click submit It takes me to the Confirmation_Page.php HOWEVER It doesn't show me the information I've inputed it into the form Eg.It only shows Your forename is : please help me I need to hand this in by monday thanks to everyone who tries to help me :l Quote Link to comment https://forums.phpfreaks.com/topic/233196-php-script-soz-im-a-beginner/ Share on other sites More sharing options...
PaulRyan Posted April 9, 2011 Share Posted April 9, 2011 The input field is name Forname, you are trying to display a variable named Forename. Replace the following line from the Confirmation_Page.php Your forename is : <?php echo $_GET["Forename"];?><br /> To the following Your forename is : <?php echo $_GET["Forname"];?><br /> Tell me how it goes Regards, PaulRyan. Quote Link to comment https://forums.phpfreaks.com/topic/233196-php-script-soz-im-a-beginner/#findComment-1199265 Share on other sites More sharing options...
powW Posted April 9, 2011 Author Share Posted April 9, 2011 The input field is name Forname, you are trying to display a variable named Forename. Replace the following line from the Confirmation_Page.php Your forename is : <?php echo $_GET["Forename"];?><br /> To the following Your forename is : <?php echo $_GET["Forname"];?><br /> Tell me how it goes Regards, PaulRyan. Thank you for the quick reply I tried that but it unfortunately didn't work In the form I also have things like surname email class none of these work :l I can provide print screens as well. Quote Link to comment https://forums.phpfreaks.com/topic/233196-php-script-soz-im-a-beginner/#findComment-1199266 Share on other sites More sharing options...
powW Posted April 9, 2011 Author Share Posted April 9, 2011 This is my form This is what i get when i click Submit This is the code in the confirmation page Quote Link to comment https://forums.phpfreaks.com/topic/233196-php-script-soz-im-a-beginner/#findComment-1199267 Share on other sites More sharing options...
Pikachu2000 Posted April 9, 2011 Share Posted April 9, 2011 Instead of posting screenshots of the code, just post the code between . . . tags so it can actually be debugged by someone willing to take the time to do so. Quote Link to comment https://forums.phpfreaks.com/topic/233196-php-script-soz-im-a-beginner/#findComment-1199271 Share on other sites More sharing options...
powW Posted April 9, 2011 Author Share Posted April 9, 2011 Sorry guys :l <title>Confirmation_Page.php</title> <style type="text/css"> <!-- body { background-color: #999; --> </style></head> <body> <Label> <p>The Date you require is : <?php echo $_GET["Date_Required"];?><br /> <p> </p><p> <Label> Your Title is : <?php echo $_GET["Title"];?><br /> </Label> <p> </p><p> <Label> Your forename is : <?php echo $_GET["Forname"];?><br /> </Label> <p> </p><p> <Label> Your surname is : <?php echo $_GET["Surname"];?><br /> </Label> <p> </p><p> <Label> Your Email address is : <?php echo $_GET["Email_address_of_person_applying_for_tickets"];?><br /> </Label> <p> </p><p> <p>Details of Student </p> <p></p> <Label> Your Childs forename is: <?php echo $_GET["Forname_Of_Student_attending_Dulton_School"];?><br /> </Label> <p> </p><p> <Label> Your Childs Surname is : <?php echo $_GET["Surname_Of_Student_attending_Dulton_School"];?><br /> </Label> <p> </p><p> <Label> Your child attends class : <?php echo $_GET["Class"];?><br /> </Label> <p> </p><p> <Label> The number of Adult tickets you require are: <?php echo $_GET["Number_Of_Adult_Tickets"];?><br /> </Label> <p> </p><p> <Label> The number of Student tickets you require are : <?php echo $_GET["Number_Of_Student_Tickets"];?><br /> </Label> <p> </p><p> <Label> The number of OAP tickets you require are : <?php echo $_GET["Number_Of_OAP_Tickets"];?><br /> </Label> <p> </p><p> <Label> Your method of payment is : <?php echo $_GET["Method_of_payment"];?><br /> </Label> <p> <Label> </p><p> </body> </html> [code/] Also if it helps this is the code for the Form page (ticket request) <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Untitled Document</title> <style type="text/css"> <!-- body { background-color: #999; } #form1 p { font-family: Tahoma, Geneva, sans-serif; font-size: 13px; } #form1 p { } --> </style></head> <body> <form id="form1" name="form1" method="get" action="Confirmation_page.php"> <p><img src="../Images/grease12.jpg" width="515" height="336" /></p> <p>Picture taken from last years production of Grease.</p> <p> Grease had its Broadway première in 1972 and has triumphed throughout the world. In 1979 Grease took over the record as the longest-running show in the history of Broadway and now your child has been given the opertunity to be in this classical. The school production will last for 3 days on the 3rd, 4th and 5th of May 2011. It will last for 1 hour and a half. </p> <p> Here are the prices: adults £8.00; students/children £6.00; and OAP £5.00</p> <p> <label>Date Required <input type="text" name="Date_Required" id="Date_Required" /> </label> </p> <p>Details Of Parent/Carer </p> <p> <label>Title <input type="text" name="Title" id="Title" /> </label> </p> <p> <label>Forename <input type="text" name="Forname" id="Forname" /> </label> </p> <p> <label>Surname <input type="text" name="Surname" id="Surname" /> </label> </p> <p> <label>Email address of person applying for tickets <input type="text" name="Email_address_of_person_applying_for_tickets" id="Email_address_of_person_applying_for_tickets" /> </label> </p> <p>Details Of Student</p> <p> <label>Forename Of Student attending Dulton School <input type="text" name="Forname_Of_Student_attending_Dulton_School" id="Forname_Of_Student_attending_Dulton_School" /> </label> </p> <p> <label>Surname Of Student attending Dulton School <input type="text" name="Surname_Of_Student_attending_Dulton_School" id="Surname_Of_Student_attending_Dulton_School" /> </label> </p> <p> <label>Class <input type="text" name="Class" id="Class" /> </label> </p> <p> <label>Number Of Adult Tickets <select name="Number_Of_Adult_Tickets" id="Number_Of_Adult_Tickets"> <option value="1">1</option> <option value="2">2</option> <option value="3">3</option> <option value="4">4</option> <option value="5">5</option> <option value="6">6</option> <option value="7">7</option> <option value="8">8</option> <option value="9">9</option> <option value="10">10</option> <option value="11">11</option> <option value="12">12</option> <option value="13">13</option> <option value="14">14</option> <option value="15">15</option> <option value="0">0</option> </select> </label> </p> <p> <label>Number Of Student Tickets <select name="Number_Of_Student_Tickets" id="Number_Of_Student_Tickets"> <option value="1">1</option> <option value="2">2</option> <option value="3">3</option> <option value="4">4</option> <option value="5">5</option> <option value="6">6</option> <option value="7">7</option> <option value="8">8</option> <option value="9">9</option> <option value="10">10</option> <option value="11">11</option> <option value="12">12</option> <option value="13">13</option> <option value="14">14</option> <option value="15">15</option> <option value="0">0</option> </select> </label> </p> <p> <label>Number Of OAP Tickets <select name="Number_Of_OAP_Tickets" id="Number_Of_OAP_Tickets"> <option value="1">1</option> <option value="2">2</option> <option value="3">3</option> <option value="4">4</option> <option value="5">5</option> <option value="6">6</option> <option value="7">7</option> <option value="8">8</option> <option value="9">9</option> <option value="10">10</option> <option value="11">11</option> <option value="12">12</option> <option value="13">13</option> <option value="14">14</option> <option value="15">15</option> <option value="0">0</option> </select> </label> </p> <p> <label>Method of Payment (Cash or Cheque) <input type="text" name="Method of Payment (Cash or Cheque)" id="Method of Payment (Cash or Cheque)" /> </label> </p> <p> <label> <input type="submit" name="Submit" id="Submit" value="Submit" /> </label> </p> <p> </p> <p> </p> <p> </p> <p> </p> </form> </body> </html> [code/] Quote Link to comment https://forums.phpfreaks.com/topic/233196-php-script-soz-im-a-beginner/#findComment-1199274 Share on other sites More sharing options...
Pikachu2000 Posted April 9, 2011 Share Posted April 9, 2011 The only 2 problems I see initially are below. Otherwise, you should be getting the values for the rest of the from fields echoed when the form is submitted. Look at the name= attribute . . . <input type="text" name="Method of Payment (Cash or Cheque)" id="Method of Payment (Cash or Cheque)" /> And the spelling/mismatch of the array index. Your method of payment is : <?php echo $_GET["Method_of_payment"];?><br /> Quote Link to comment https://forums.phpfreaks.com/topic/233196-php-script-soz-im-a-beginner/#findComment-1199308 Share on other sites More sharing options...
powW Posted April 9, 2011 Author Share Posted April 9, 2011 The only 2 problems I see initially are below. Otherwise, you should be getting the values for the rest of the from fields echoed when the form is submitted. Look at the name= attribute . . . <input type="text" name="Method of Payment (Cash or Cheque)" id="Method of Payment (Cash or Cheque)" /> And the spelling/mismatch of the array index. Your method of payment is : <?php echo $_GET["Method_of_payment"];?><br /> Yh my friends kinda have the same coding but with different variables and stuff theres is working mine isn't :l Quote Link to comment https://forums.phpfreaks.com/topic/233196-php-script-soz-im-a-beginner/#findComment-1199324 Share on other sites More sharing options...
powW Posted April 9, 2011 Author Share Posted April 9, 2011 The only 2 problems I see initially are below. Otherwise, you should be getting the values for the rest of the from fields echoed when the form is submitted. Look at the name= attribute . . . <input type="text" name="Method of Payment (Cash or Cheque)" id="Method of Payment (Cash or Cheque)" /> And the spelling/mismatch of the array index. Your method of payment is : <?php echo $_GET["Method_of_payment"];?><br /> I might have done something wrong on the New site / manage site in dreamweaver if I show you what I did would you beable to see if somethings wrong? Quote Link to comment https://forums.phpfreaks.com/topic/233196-php-script-soz-im-a-beginner/#findComment-1199328 Share on other sites More sharing options...
Pikachu2000 Posted April 9, 2011 Share Posted April 9, 2011 At the top of the Confirmation_page.php script, add the following lines and post the output generated when the form is submitted: echo '////// $_GET array: //////<br><pre>'; print_r($_GET); echo '</pre><br>////// End $_GET array //////'; [/code] Quote Link to comment https://forums.phpfreaks.com/topic/233196-php-script-soz-im-a-beginner/#findComment-1199397 Share on other sites More sharing options...
powW Posted April 9, 2011 Author Share Posted April 9, 2011 At the top of the Confirmation_page.php script, add the following lines and post the output generated when the form is submitted: echo '////// $_GET array: //////<br><pre>'; print_r($_GET); echo '</pre><br>////// End $_GET array //////'; [/code] echo '////// $_GET array: //////<br><pre>'; print_r($_GET); echo '</pre><br>////// End $_GET array //////'; <title>Confirmation_Page.php</title> <style type="text/css"> <!-- body { background-color: #999; --> </style></head> <body> <Label> <p>The Date you require is : <?php echo $_GET["Date_Required"]; ?><br /><Label> <p> </p><p> <Label> Your Title is : <?php echo $_GET["Title"]; ?><br /></Label> <p> </p><p> <Label> Your forename is : <?php echo $_GET["Forename"]; ?><br /></Label> <p> </p><p> <Label> Your surname is : <?php echo $_GET["Surname"]; ?><br /></Label> <p> </p><p> <Label> Your Email address is : <?php echo $_GET["Email_address_of_person_applying_for_tickets"]; ?><br /></Label> <p> </p><p> <p>Details of Student </p> <p></p> <Label> Your Childs forename is: <?php echo $_GET["Forename_Of_Student_attending_Dulton_School"]; ?><br /></Label> <p> </p><p> <Label> Your Childs Surname is : <?php echo $_GET["Surname_Of_Student_attending_Dulton_School"];?> <br /></Label> <p> </p><p> <Label> Your child attends class : <?php echo $_GET["Class"];?> <br /></Label> <p> </p><p> <Label> The number of Adult tickets you require are: <?php echo $_GET["Number_Of_Adult_Tickets"]; ?><br /></Label> <p> </p><p> <Label> The number of Student tickets you require are : <?php echo $_GET["Number_Of_Student_Tickets"];?> <br /></Label> <p> </p><p> <Label> The number of OAP tickets you require are : <?php echo $_GET["Number_Of_OAP_Tickets"]; ?><br /> </Label> <p> </p><p> <Label>Your method of payment is : <?php echo $_GET["Method of Payment (Cash or Cheque)"]; ?><br /> </Label> <p> <Label> </p><p> </body> </html> [/code] That's what came up :l Quote Link to comment https://forums.phpfreaks.com/topic/233196-php-script-soz-im-a-beginner/#findComment-1199399 Share on other sites More sharing options...
Pikachu2000 Posted April 9, 2011 Share Posted April 9, 2011 Yeah, enclose it <?php ?> tags . . . <?php echo '////// $_GET array: //////<br><pre>'; print_r($_GET); echo '</pre><br>////// End $_GET array //////'; ?> Quote Link to comment https://forums.phpfreaks.com/topic/233196-php-script-soz-im-a-beginner/#findComment-1199404 Share on other sites More sharing options...
powW Posted April 9, 2011 Author Share Posted April 9, 2011 Yeah, enclose it <?php ?> tags . . . <?php echo '////// $_GET array: //////<br><pre>'; print_r($_GET); echo '</pre><br>////// End $_GET array //////'; ?> So put the code at the top and instead of <?php use <?php?> Quote Link to comment https://forums.phpfreaks.com/topic/233196-php-script-soz-im-a-beginner/#findComment-1199407 Share on other sites More sharing options...
kartul Posted April 9, 2011 Share Posted April 9, 2011 One thing to notice, You are using very long index keys, maximum length of GET is 255. Maybe You are exceeding that limit and therefor the data is missing. Try using POST or shorten Your index keys. Also, name (html attribute) == index key (php $_GET[indexkey]! Otherwise it wont work. Quote Link to comment https://forums.phpfreaks.com/topic/233196-php-script-soz-im-a-beginner/#findComment-1199408 Share on other sites More sharing options...
powW Posted April 9, 2011 Author Share Posted April 9, 2011 One thing to notice, You are using very long index keys, maximum length of GET is 255. Maybe You are exceeding that limit and therefor the data is missing. Try using POST or shorten Your index keys. Also, name (html attribute) == index key (php $_GET[indexkey]! Otherwise it wont work. umm What's an html attribute? And what's an index key? Quote Link to comment https://forums.phpfreaks.com/topic/233196-php-script-soz-im-a-beginner/#findComment-1199409 Share on other sites More sharing options...
Pikachu2000 Posted April 9, 2011 Share Posted April 9, 2011 One thing to notice, You are using very long index keys, maximum length of GET is 255. Maybe You are exceeding that limit and therefor the data is missing. Try using POST or shorten Your index keys. That isn't correct. The length limit depends on the browser, with Internet Exploder's limit being 2083 chars. Quote Link to comment https://forums.phpfreaks.com/topic/233196-php-script-soz-im-a-beginner/#findComment-1199412 Share on other sites More sharing options...
powW Posted April 9, 2011 Author Share Posted April 9, 2011 Yeah, enclose it <?php ?> tags . . . <?php echo '////// $_GET array: //////<br><pre>'; print_r($_GET); echo '</pre><br>////// End $_GET array //////'; ?> Yh the exact same thing happened when I put that at the top Quote Link to comment https://forums.phpfreaks.com/topic/233196-php-script-soz-im-a-beginner/#findComment-1199417 Share on other sites More sharing options...
Pikachu2000 Posted April 9, 2011 Share Posted April 9, 2011 Copy and paste the html source resulting from doing a View ---> Source in your browser, and cut and paste the entire URL string from the address bar. Something's not right here. Quote Link to comment https://forums.phpfreaks.com/topic/233196-php-script-soz-im-a-beginner/#findComment-1199419 Share on other sites More sharing options...
powW Posted April 9, 2011 Author Share Posted April 9, 2011 Copy and paste the html source resulting from doing a View ---> Source in your browser, and cut and paste the entire URL string from the address bar. Something's not right here. umm is this for the confirmation page or ticket riquest page? Quote Link to comment https://forums.phpfreaks.com/topic/233196-php-script-soz-im-a-beginner/#findComment-1199422 Share on other sites More sharing options...
Pikachu2000 Posted April 9, 2011 Share Posted April 9, 2011 For Confirmation_page.php, after submitting the form and arriving at it. Quote Link to comment https://forums.phpfreaks.com/topic/233196-php-script-soz-im-a-beginner/#findComment-1199425 Share on other sites More sharing options...
powW Posted April 9, 2011 Author Share Posted April 9, 2011 For Confirmation_page.php, after submitting the form and arriving at it. Should I type in any values? Or should I just keep everything empty and click submit? Quote Link to comment https://forums.phpfreaks.com/topic/233196-php-script-soz-im-a-beginner/#findComment-1199427 Share on other sites More sharing options...
Pikachu2000 Posted April 9, 2011 Share Posted April 9, 2011 Fill it all in and submit it . . . Quote Link to comment https://forums.phpfreaks.com/topic/233196-php-script-soz-im-a-beginner/#findComment-1199428 Share on other sites More sharing options...
powW Posted April 9, 2011 Author Share Posted April 9, 2011 Fill it all in and submit it . . . file:///C:/xampp/htdocs/Dulton%20Webpage/Ticket%20request/Confirmation_Page.php?Date_Required=3rd&Title=Mr&Forename=Bobby&Surname=BoB&Email_address_of_person_applying_for_tickets=Bob&Forename_Of_Student_attending_Dulton_School=bob&Surname_Of_Student_attending_Dulton_School=bob&Class=7y&Number_Of_Adult_Tickets=6&Number_Of_Student_Tickets=7&Number_Of_OAP_Tickets=5&Method+of+Payment+%28Cash+or+Cheque%29=Cash&Submit=Submit Quote Link to comment https://forums.phpfreaks.com/topic/233196-php-script-soz-im-a-beginner/#findComment-1199432 Share on other sites More sharing options...
PFMaBiSmAd Posted April 9, 2011 Share Posted April 9, 2011 LOL That's not a URL. Quote Link to comment https://forums.phpfreaks.com/topic/233196-php-script-soz-im-a-beginner/#findComment-1199433 Share on other sites More sharing options...
Pikachu2000 Posted April 9, 2011 Share Posted April 9, 2011 Stop right there. You have to load the file into the web browser by calling it from the webserver. http://localhost/, not file:///C:/. And you'll want to remane any directories in there so they have no spaces in the names. Quote Link to comment https://forums.phpfreaks.com/topic/233196-php-script-soz-im-a-beginner/#findComment-1199434 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.