Jump to content

Help with an Assignment


stepo

Recommended Posts

Hello

 

I have an assignment and I am really struggling with it, just wondering if anyone can give me a start or some help with it. I have uploaded the files we have been given and also the details of what we need

 

I am really stuck and appreciate any help :) thanks

 

[attachment deleted by admin]

Link to comment
Share on other sites

5 key stages in the assignment, and no indication to which part you are struggling with, I expect I speak for many members when I say 'jog on'

 

this is a help forum, not a 'hand your assignment over to a stranger to do' forum.

 

You post indicates no thought processes towards your assigned work, none of us are mind readers, give us something, we are likely to give something back.

 

 

 

 

Link to comment
Share on other sites

im sorry im new to this forum stuff,

 

im on stage 2 and struggling with the info.html part. and sending the info thats selected from the user to be able to be then used in the sendinfo.php part.

 

pretty much stage 2 has completely got me stuck, have no idea where to go with it.

 

 

Link to comment
Share on other sites

create the new page called info.html

 

make a select dropdown box or a radio button (checkboxes allow multiple sections and it states one select 1 type)

 

add options like banks,oil,gold,frozen oj,pork bellies, etc

 

the sendinfo.php will then get the value selected lets say it was oil, and returns information about oil stocks.

in this case the assignment states open a text file thats relevant, so i would suggest you make a correlation of:  filenames = values from the form.

 

user selects oil, open file oil.txt and read contents into webpage.

user selects banks, it opens banks.txt

 

read a text file link

 

 

Link to comment
Share on other sites

Im using dreamweaver and there is a form wizard i follow through to make a few radio buttons but the code behind them confuses me. Whats the difference between value and ID?

 

Also from the info.html page when the user selects an option eg.. banks then how is that variable then carried through onto another page?

Link to comment
Share on other sites

oh boy, erm how much php have you done?  :P

 

read this

 

id is like a name but unique, rather than name can be multiple (radio buttons have the same name) of the form element, value is whats stored in that form element

 

<input name="username"  value="stepo">  this will give text input with a prefilled value of stepo

 

retrieve it from form by trying echo $_POST['username']

 

 

Link to comment
Share on other sites

only had 4 lectures on it, its a nightmare I dont like it at all.  :'(

 

I think I understand that a bit better, what about the submit code? I have added the radio buttons and have the form.

 

<form name="form1" method="post" action="">

  <p>

    <label>

      <input type="radio" name="stockinfo" value="radio" id="stockinfo_0">

    Aviation and Aerospace</label>

    <br>

    <label>

      <input type="radio" name="stockinfo" value="radio" id="stockinfo_1">

      Banks</label>

    <br>

    <label>

      <input type="radio" name="stockinfo" value="radio" id="stockinfo_2">

      Construction</label>

    <br>

    <label>

      <input type="radio" name="stockinfo" value="radio" id="stockinfo_3">

      Electronics</label>

    <br>

    <label>

      <input type="radio" name="stockinfo" value="radio" id="stockinfo_4">

      Oil and Gas</label>

    <br>

    <label>

      <input type="radio" name="stockinfo" value="radio" id="stockinfo_5">

      Pharmaceuticals</label>

    <br>

  </p>

  <input type="submit" name="submit" value="Submit">

</form>

 

What exactly do I do next to get the user to the next page when the submit button is pressed?

Link to comment
Share on other sites

change the action of the form to the name of the php file you are posting to, i.e. sendinfo.php, if you dont give action a value it will post to itself

 

the radio buttons are nearly there, you dont really need the id in this instance, change the values to be the same as the label text:

<label>
<input type="radio" name="stockinfo" value="aviation" id="stockinfo_0">
    Aviation and Aerospace</label>

 

as you have it they all contain the value of 'radio'

 

in the php page have this:

 

echo $_POST['stockinfo'];

 

when you POST a form all the input elements are put into the $_POST[] array, then use the name of the element you want to retrieve the value from into that array

so for the radio button elements you have i use $_POST['stockinfo']

if you had a text input in the form aswell with asking for the user to enter there name that looks like this:

<label><input type="text" name="myname">
    Enter name</label>

you would get the value by

 

echo $_POST['myname'];

 

dont worry the php will get easier, especially if you hand code it, dreamweaver is great but it doesnt actually teach you php, its more a designers tool than a developers (in my opinion), notepad++ is what I use personally.

Link to comment
Share on other sites

Thanks for that help,

 

can you tell me how to be able to prevent the form from submitting without having a box ticked. Ive tried some code but having trouble getting it to work...

 

I am at stage 3.

  <FORM NAME="priceForm" method="post" action="goodbye.php">
      <P/>
      <TABLE>
      <TR>
      <TD></TD>
      	<TD></TD>
      <TD>Price(£)</TD>
      </TR>
      <TR>
      <TD><INPUT TYPE="checkbox" NAME="Markets" VALUE="Aviation and Aerospace"
      	      onClick="showPrices(1)"></INPUT></TD>
      <TD>Aviation and Aerospace</TD>
      	<TD><INPUT TYPE="text" NAME="AviationField" SIZE="5" VALUE=""></INPUT></TD>
      </TR>
      <TR>
      <TD><INPUT TYPE="checkbox" NAME="Markets" VALUE="Banks"
      	      onClick="showPrices(2)"></INPUT></TD>
      <TD>Banks</TD>
      	<TD><INPUT TYPE="text" NAME="BanksField" SIZE="5" VALUE=""></INPUT></TD>
      </TR>
       <TR>
      <TD><INPUT TYPE="checkbox" NAME="Markets" VALUE="Construction"
      	      onClick="showPrices(3)"></INPUT></TD>
      <TD>Construction</TD>
      	<TD><INPUT TYPE="text" NAME="ConstructionField" SIZE="5" VALUE=""></INPUT></TD>
      </TR>
      <TR>
      <TD><INPUT TYPE="checkbox" NAME="Markets" VALUE="Electronics"
      	      onClick="showPrices(4)"></INPUT></TD>
      <TD>Electronics</TD>
      	<TD><INPUT TYPE="text" NAME="ElectronicsField" SIZE="5" VALUE=""></INPUT></TD>
      </TR>
      <TR>
      <TD><INPUT TYPE="checkbox" NAME="Markets" VALUE="Oil and Gas"
      	      onClick="showPrices(5)"></INPUT></TD>
      <TD>Oil and Gas</TD>
      	<TD><INPUT TYPE="text" NAME="OilandGasField" SIZE="5" VALUE=""></INPUT></TD>
      </TR>
      <TR>
      <TD><INPUT TYPE="checkbox" NAME="Markets" VALUE="Pharmaceuticals"
      	      onClick="showPrices(6)"></INPUT></TD>
      <TD>Pharmaceuticals</TD>
      	<TD><INPUT TYPE="text" NAME="PharmaceuticalsField" SIZE="5" VALUE=""></INPUT></TD>
      </TR>
      
<TR>
      <TD></TD>
      	<TD>Total:</TD>
      <TD><INPUT TYPE="text" NAME="TotalField" SIZE="5" VALUE="0"></INPUT></TD>
      </TR>
      </TABLE>
      <p>
  <input type="submit" name="submit" value="Subscribe">
    </FORM>
  

Link to comment
Share on other sites

think I have got that sorted myself,

 

Im now on the stage 3 number 2. could you explain how to carry through the name variable from this page to the goodbye page. Also how do I interpret what the user has selected in the from the checkboxes and carry this through onto the next page? and also the total money part also?

 

I appreciate any help..

 

 

Link to comment
Share on other sites

Hello

 

Ive been creating a small assignment for my University. I've attached the assignment folder its all done, just if anyone fancys giving it a look over to see if it looks fine? Or if I need to change anything.

 

Thanks in advance

 

 

 

[attachment deleted by admin]

Link to comment
Share on other sites

Hello

 

Ive been creating a small assignment for my University. I've attached the assignment folder its all done, just if anyone fancys giving it a look over to see if it looks fine? Or if I need to change anything.

 

Thanks in advance

 

 

Is there a problem with it?  What exactly do you want us to inspect?  36k of code isn't exactly a light look-over.

Link to comment
Share on other sites

From what I can see it is working but in terms of tidiness and punctual? Also in the goodbye.php file I have used a loop and it works but wether or not I actually need that loop confuses me. It works but it will get downmarket and I just cant understand that part really?  Also any help with stage 5 would be great?

Link to comment
Share on other sites

From what I can see it is working but in terms of tidiness and punctual? Also in the goodbye.php file I have used a loop and it works but wether or not I actually need that loop confuses me. It works but it will get downmarket and I just cant understand that part really?  Also any help with stage 5 would be great?

Post the relevant code with the corresponding issue and we will help.

Link to comment
Share on other sites

I have a textbox for a user to submit there name and then I POST there inputted username onto a welcome page, is there code to remove any unnecessary whitespaces from the username?

You can use trim.  If you want to do something else, then provide a more detailed explanation and/or examples.

Link to comment
Share on other sites

Sorry about the double post, I got that trim to work. Any chance of help about stage 5? I dont even really know where to start with it?

I'm not downloading your code, post the relevant part(s).

Link to comment
Share on other sites

Sorry people, Im a complete novice at this forum stuff.

 

Anyway...

 

I have a sign in page

 

 <form action ="select.php" method="post">
	Enter your name: <input type="text" name="CodeField">
	<input type="submit" VALUE="Submit">
  </form>

 

From here this must create an info.php script that gets the users name from the submit box from the sign in page. This info.php page will also display the lists of options of available info such as, Banks, Construction, Aeroplanes etc.

 

It then needs to augmented with the users name in a hidden field and modified so that it connects to a different script (sendinfo2.php). This new sendinfo.php script will do the checking. By checking I mean it will read the contents of a text file (subscriptions.txt)

 

The format that the data is held in the txt file is as follows:

 

stepo    Banks;Construction

 

As you can see they are my subscriptions. So sendinfo2.php checks the txt file and decides whether that user has subscribed to a certain option. if he has then it will let the user choose only the categories they have subscribed to. If not then it must display an appropriate message.

 

 

Oh and just to clarify I am not interested in creating or updating the subscriptions file. I will just put some data into that myself and check the system.

 

Hope this helps to explain. Its a nightmare...

 

 

Link to comment
Share on other sites

:confused::suicide:

 

Ok, let me get this right.  You have a Form.. FormA which POSTs to info.php

 

info.php displays a list of stuff dependent upon a text file and the username?

and sendinfo2.php .... adds to the text file?

 

Maybe it's the excess of forms, but I'm slightly confused.  What exactly is wrong?

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.