SitePoint Sponsor

User Tag List

Results 1 to 4 of 4

Thread: processing data

  1. #1
    SitePoint Guru
    Join Date
    Oct 2004
    Location
    uk
    Posts
    853
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    processing data

    Hi guys

    can anyone see any errors?

    Im trying to keep the form data in the from when a user has to go back to the form


    for some reason sublocation works but none of the others do
    add.php
    PHP Code:
    <?php
        session_start
    ();
    ?>
    <form method='post' action='somewhere.php'>
    <TABLE>
    <Tr>
    <td>
    <font size="3" face="century gothic">
    </td>
    </tR>
    <TR>
    <TD> 
    <font face="century gothic" size="4">Catergory:</TD><TD> <select name="catergory">
        <option value="">------------------------- Please select a category -------------------------- </option>
        <option value="AeroSpace"> AeroSpace </option>
        <option value="Agriculture, Fishing, Forestry"> Agriculture, Fishing, Forestry </option>
        <option value="Banking, Insurance, Finance"> Banking, Insurance, Finance </option>
        <option value="Catering & Hospitality"> Catering & Hospitality </option>
        <option value="Construction"> Construction </option>
        <option value="Customer services, Call centres"> Customer services, Call centres </option>
        <option value="Catering & Hospitality"> Catering & Hospitality </option>
        <option value="Education"> Education </option>
        <option value="Electronics"> Electronics </option>
        <option value="Engineering, Manufacturing, Utilities"> Engineering, Manufacturing, Utilities </option>
        <option value="Graduate"> Graduate </option>
        <option value="Health, Nursing"> Health, Nursing </option>
        <option value="Human resources"> Human resources </option>
        <option value="IT & Internet"> IT & Internet </option>
        <option value="Legal"> Legal </option>
        <option value="Management consultancy"> Management consultancy </option>
        <option value="Marketing, Advertising, PR"> Marketing, Advertising, PR </option>
        <option value="Media, New media, Creative"> Media, New media, Creative </option>
        <option value="Not for profit, Charities"> Not for profit, Charities </option>
        <option value="Property"> Property </option>
        <option value="Public sector & Services"> Public sector & Services </option>
        <option value="Recruitment sales"> Recruitment sales </option>
        <option value="Retail, Wholesale"> Retail, Wholesale </option>
        <option value="Sales"> Sales </option>
        <option value="AeroSpace"> AeroSpace </option>
        <option value="Agriculture, Fishing, Forestry"> Agriculture, Fishing, Forestry </option>
        <option value="Banking, Insurance, Finance"> Banking, Insurance, Finance </option>
        <option value="AeroSpace"> AeroSpace </option>

    </select></TD><td valign="top"><img src="required.gif"></td></TR>
    <TR><TD><font face="century gothic" size="4">Location:</TD><TD> <select name="location" value="<? htmlspecialchars($_POST['location']); ?>">
        <option value="">------------------------- Please select a Location -------------------------- </option>
    <option value="Avon">Avon </option>
    <option value="Bedfordshire">Bedfordshire</option> 
    <option value="Berkshire">Berkshire</option>
    <option value="Buckinghamshire"> Buckinghamshire </option>
    <option value="Cambridgeshire">Cambridgeshire </option>
    <option value="Cheshire">Cheshire </option>
    <option value="Cleveland">Cleveland </option>
    <option value="Cornwall">Cornwall </option>
    <option value="Cotswolds">Cotswolds </option>
    <option value="Cumbria">Cumbria  </option>
    <option value="Derbyshire">Derbyshire </option>
    <option value="Devon"> Devon </option>
    <option value="Dorset"> Dorset </option>
    <option value="Durham"> Durham </option>
    <option value="East Anglia"> East Anglia </option>
    <option value="East Midlands"> East Midlands </option>
    <option value="East Sussex"> East Sussex </option>
    <option value="Essex"> Essex </option>
    <option value="Gloucestershire"> Gloucestershire </option>
    <option value="Greater London"> Greater London </option>
    <option value="Greater Manchester"> Greater Manchester </option>
    <option value="Hampshire"> Hampshire </option>
    <option value="Herefordshire"> Herefordshire </option>
    <option value="Hertfordshire"> Hertfordshire </option>
    <option value="Humberside"> Humberside </option>
    <option value="Isle of Wight"> Isle of Wight </option>
    <option value="Isles of Scilly"> Isles of Scilly</option> 
    <option value="Kent">  Kent </option> 
    <option value="Lake District"> Lake District </option>
    <option value="Lancashire"> Lancashire </option>
    <option value="Leicestershire"> Leicestershire </option>
    <option value="Lincolnshire"> Lincolnshire </option>
    <option value="Merseyside"> Merseyside </option>
    <option value="Norfolk"> Norfolk </option>
    <option value="North Yorkshire"> North Yorkshire </option>
    <option value="Northamptonshire"> Northamptonshire </option>
    <option value="Northumberland"> Northumberland </option>
    <option value="Northumbria"> Northumbria </option>
    <option value="Nottinghamshire"> Nottinghamshire </option>
    <option value="Oxfordshire"> Oxfordshire </option>
    <option value="Rutland"> Rutland </option>
    <option value="Shropshire"> Shropshire </option>
    <option value="Somerset"> Somerset </option>
    <option value="South Yorkshire"> South Yorkshire </option>
    <option value="Staffordshire"> Staffordshire </option>
    <option value="Suffolk"> Suffolk </option>
    <option value="Surrey"> Surrey </option>
    <option value="Tyne and Wear"> Tyne and Wear </option>
    <option value="Warwickshire"> Warwickshire </option>
    <option value="West Country"> West Country </option>
    <option value="West Midlands"> West Midlands </option>
    <option value="West Sussex"> West Sussex </option>
    <option value="West Yorkshire"> West Yorkshire </option>
    <option value="Wiltshire"> Wiltshire </option>
    <option value="Worcestershire"> Worcestershire </option>
    <option value="Yorkshire"> Yorkshire </option>

    </select></TD><td valign="top"><img src="required.gif"></td></TR>
    <TR><TD><font face="century gothic" size="4">Sub Location: </TD>
    <TD><input type="text" size="60" name="sublocation" value="<?=$_SESSION['sublocation']?>" />


    </TD>
    <td valign="top"><img src="required.gif"></td></TR>

    <TR><TD><font face="century gothic" size="4">Job Title: </TD>
    <TD><input type="text" size="60" name="jobtitle" value="<?=$_SESSION['jobtitle']?>" /></TD>
    <td valign="top"><img src="required.gif"></td></TR>
    <TR><TD valign="top"><font face="century gothic" size="4">Job Description:</TD>
    <TD> <textarea rows="15" cols="45" name="jobdescription" wrap="physical" value="<? htmlspecialchars($_POST['jobdescription']); ?>"></textarea><br /></TD>
    <td valign="top"><img src="required.gif"></td></TR>





    <TR><TD><font face="century gothic" size="4">Salary: </TD><TD><select name="salary" value="<? htmlspecialchars($_POST['salary']); ?>">

        <option value="">-------------------------- Please select a Salary --------------------------- </option>
    <option value="0 - £9,999">0 - £9,999</option>
    <option value="£10,000 - £11,999">£10,000 - £11,999</option>
    <option value="£12,000 - £13,999">£12,000 - £13,999</option>
    <option value="£14,000 - £15,999">£14,000 - £15,999</option>
    <option value="£16,000 - £17,999">£16,000 - £17,999</option>
    <option value="£18,000 - £19,999">£18,000 - £19,999</option>
    <option value="£20,000 - £23,999">£20,000 - £23,999</option>
    <option value="£24,000 - £27,999">£24,000 - £27,999</option>
    <option value="£28,000 - £31,999">£28,000 - £31,999</option>
    <option value="£32,000 - £35,999">£32,000 - £35,999</option>
    <option value="£36,000 - £39,999">£36,000 - £39,999</option>
    <option value="£40,000 - £49,999">£40,000 - £49,999</option>
    <option value="£50,000 - ">50,000 - </option>

    </select></TD><td valign="top"><img src="required.gif"></td></TR>
    <TR><TD><font face="century gothic" size="4">Job Status:</TD><TD><select name="jobstatus" value="<? htmlspecialchars($_POST['jobstatus']); ?>">
        <option value="">----------------------- Please select a Job Status ------------------------ </option>
    <option value="Permanent">Permanent</option>
    <option value="Part Time">Part Time</option>
    <option value="Temporary">Temporary</option>

    </select></TD><td valign="top"><img src="required.gif"></td></TR>
    <tr><td><font face="century gothic" size="4"><b>Contact Info</b></td></tr>
    <TR><TD><font face="century gothic" size="4">Company:</TD><TD><input type="text" size="60" name="company" value="<? htmlspecialchars($_POST['company']); ?>"></TD><td valign="top"><img src="required.gif"></td></TR>
    <TR><TD><font face="century gothic" size="4">First Name:</TD><TD><input type="text" size="60" name="firstname" value="<? htmlspecialchars($_POST['firstname']); ?>"></TD><td valign="top"><img src="required.gif"></td></TR>
    <TR><TD><font face="century gothic" size="4">Surname:</TD><TD><input type="text" size="60" name="surname" value="<? htmlspecialchars($_POST['surname']); ?>"></TD><td valign="top"><img src="required.gif"></td></TR>
    <TR><TD><font face="century gothic" size="4">E Mail:</TD><TD><input type="text" size="60" name="email" value="<? htmlspecialchars($_POST['email']); ?>"></TD><td valign="top"><img src="required.gif"></td></TR>
    <TR><TD><font face="century gothic" size="4">Telephone:</TD><TD><input type="text" size="60" name="telephone" value="<? htmlspecialchars($_POST['telephone']); ?>"></TD><td valign="top"><img src="required.gif"></td></TR>
    <TR><TD><font face="century gothic" size="4">Fax:</TD><TD><input type="text" size="60" name="fax" value="<? htmlspecialchars($_POST['fax']); ?>"></TD><td valign="top"><img src="required.gif"></td></TR>
    </table>
    <table width="100%">
    <tr><td><font face="century gothic" size="4"><b>Payment Info</b></td></tr>
    <TR><td>
    The cost to list your job is <b>1</b> credit<br> This will automatically be deducted from your account
    <br>
    If your account has no credits you will be redirected to our payment page

    </td></TR>
    <TR>
    <TD>
    </TD>
    <TD>

    </tr></table>
    <input type="submit" value="Submit Job" />
    </form>
    insert.php
    PHP Code:
    <?php
        session_start
    ();



    $_SESSION['category'] = $_POST['category'];
    $_SESSION['location'] = $_POST['location'];
    $_SESSION['sublocation'] = $_POST['sublocation'];
    $_SESSION['jobtitle'] = $_POST['jobtitle'];
    $_SESSION['jobdescription'] = $_POST['jobdescription'];
    $_SESSION['sublocation'] = $_POST['salary'];
    $_SESSION['jobstatus'] = $_POST['jobstatus'];
    $_SESSION['company'] = $_POST['company'];
    $_SESSION['firstname'] = $_POST['firstname'];
    $_SESSION['surname'] = $_POST['surname'];
    $_SESSION['email'] = $_POST['email'];
    $_SESSION['telephone'] = $_POST['telephone'];
    $_SESSION['fax'] = $_POST['fax'];
    ?>
    Last edited by wazo; Jun 6, 2007 at 03:26.

  2. #2
    rajug.replace('Raju Gautam'); bronze trophy Raju Gautam's Avatar
    Join Date
    Oct 2006
    Location
    Kathmandu, Nepal
    Posts
    4,013
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    can anyone see any errors?
    Im trying to keep the form data in the from when a user has to go back to the form
    for some reason sublocation works but none of the others do
    What you mean? Do you mean that data are not being stored in the sessions? Or where and what is wrong? Is it giving something error? And finally why are you using such sessions and why do u need to store those values in the sessions?
    Mistakes are proof that you are trying.....
    ------------------------------------------------------------------------
    PSD to HTML - SlicingArt.com | Personal Blog | ZCE - PHP 5

  3. #3
    SitePoint Guru
    Join Date
    Oct 2004
    Location
    uk
    Posts
    853
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    user submits form
    if there is error it will tell them to go back
    when they go back all the fields are empty
    I need it so that the forms are filled with info they submitted

  4. #4
    rajug.replace('Raju Gautam'); bronze trophy Raju Gautam's Avatar
    Join Date
    Oct 2006
    Location
    Kathmandu, Nepal
    Posts
    4,013
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Why dont you submit the form on the same page so that you can use $_POST global array for getting submitted values?
    Mistakes are proof that you are trying.....
    ------------------------------------------------------------------------
    PSD to HTML - SlicingArt.com | Personal Blog | ZCE - PHP 5


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •