Jump to content

How can i make rdata variable global


VineetDubey

Recommended Posts

Hi All,

For the last post,I m very happy that i found out so many great mind who are watching my problem and solving online.

anyway great thanks for all,

just now i m making a project and i m facing problem in the below code

"i need to know how can make this code easy or how can i make rdata variable accessible for the download button"

generatecv.php file

<?php

if(isset($_REQUEST['submit']))

{

$name=$_REQUEST['pname'];

$pin=$_REQUEST['pin'];

$mnumb=$_REQUEST['mnumber'];

$tnumb=$_REQUEST['telenumber'];

$email=$_REQUEST['email'];

$obj=$_REQUEST['obj'];

$title=$_REQUEST['jobt'];

$activity=$_REQUEST['activity'];

//$file=fopen('test.doc','a+');

//echo @fwrite($file,$name);

//fclose($file);

$rdata="";

$rdata.="<table id='cvtbl' border='0' align='center' >

<th>Resume</th>

<tr><td>".$name.":</td></tr><tr><td>Objective:</td></tr>";

$rdata.="<tr><td>".$obj."</td></tr>";

$rdata.="<tr><td>Email:".$email."</td></tr>";

$rdata.="</table>";

echo $rdata;

 

echo "<style>#cv{display:none;}</style>";

echo "<form><input type='submit' name='dwnld' id='dwnld' value='Download'/></form>";

}

if(isset($_REQUEST['dwnld']))

{

header("Content-type:application/msword");

header("Content-disposition:attachment;filename=test.doc");

$fp=fopen("test.doc","r") or die("try again");

$data=fread($fp,filesize('test.doc'));

fwrite($fp,$rdata);

echo $data;

fclose($fp);

//echo $rdata."<br />".$rdata;

}

?>

 

this is the html file

 

<html>

<title>User details</title>

<body>

<form name='cv' id='cv' method="post" enctype="multipart/form-data" action='generatecv.php'>

    Enter your name<input type=text name=pname id=pname />

    Zip Code<input type=text name=pin id=pin />

    Mobile number<input type=text name=mnumber id=mnumber />

    <br />Telephone number <input type=text name=telenumber id=telenumber />

    Email address<input type=text name=email id=email />

    <br />Enter your objective<br /><textarea name=obj id=obj cols=30 rows=5 ></textarea>

<!--University Name <input type=text name=university id=university /> -->

    <br /><!--uni, city ,state ,type of degree ,full degree name,date-->

    <br /><!--Experience<br /><textarea name=exp id=exp cols=30 rows=5 ></textarea> -->

Select type of resume

<select name='type' id='type' onChange=''>

<option value='0'>Graduate</option>

<option value='1'>Post Graduate</option>

<option value='2'>Non Graguate</option>

<option value='3'>Other</option>

</select>

    Job title<input type='text' name='jobt' id='jobt' />

    <br /><!--company name,city ,state ,office number ,job description ,date of employment-->

    <br />Activity <input type=text name=activity id=activity size=100 />

    <br />Honors/Awards<input type=text name=honor id=honor size=100 />

<input type='submit' name='submit' id='submit' value='Generate CV' />

<input type='reset' name='Reset' id='submit' value='Reset' />

 

</form>

</body>

</html>

 

Many thanks in advance

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.