Jump to content

php script soz im a beginner


powW

Recommended Posts

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

 

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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/]

Link to comment
Share on other sites

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 />

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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?

Link to comment
Share on other sites

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]

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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?>

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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?

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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?

Link to comment
Share on other sites

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

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.